//ПОДСЧЕТ ОБЩЕЙ ОЦЕНКИ.
function comm_rating_get_average_ratings( $id ) {
$comments = get_approved_comments( $id );
if ( $comments ) {
$i = 0;
$total = 0;
foreach( $comments as $comment ){
$rate = get_comment_meta( $comment->comment_ID, 'rating', true );
if( isset( $rate ) && '' !== $rate && $rate < 2.5 ) {
$i++;
}
}
if ( 0 === $i ) {
return false;
} else {
return $i;
}
} else {
return false;
}
}
add_action('login_head', function(){
?>
<style>
#registerform > p:first-child{
display:none;
}
</style>
<script type="text/javascript" src="<?php echo site_url('/wp-includes/js/jquery/jquery.js'); ?>"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#registerform > p:first-child').css('display', 'none');
});
</script>
<?php
});
//Remove error for username, only show error for email only.
add_filter('registration_errors', function($wp_error, $sanitized_user_login, $user_email){
if(isset($wp_error->errors['empty_username'])){
unset($wp_error->errors['empty_username']);
}
if(isset($wp_error->errors['username_exists'])){
unset($wp_error->errors['username_exists']);
}
return $wp_error;
}, 10, 3);
add_action('login_form_register', function(){
if(!isset($_POST['user_login']) && isset($_POST['user_email']) && !empty($_POST['user_email'])){
$_POST['user_login'] = $_POST['user_email'];
}
});
function productFeature() {
global $post;
$attribute_names = array( 'pa_razmer-domika', 'pa_materialy' , 'pa_ves-v-sobrannom-vide' );
echo '<span class="attribute">';
foreach ( $attribute_names as $attribute_name ) {
$taxonomy = get_taxonomy( $attribute_name );
if ( $taxonomy && ! is_wp_error( $taxonomy ) ) {
$terms = wp_get_post_terms( $post->ID, $attribute_name );
$terms_array = array();
if ( ! empty( $terms ) ) {
foreach ( $terms as $term ) {
$full_line = '<span>'. $term->name . '</span>';
array_push( $terms_array, $full_line );
}
$tovar_name = str_replace('Товар ', '', $taxonomy->labels->name);
echo '<span class="attribute_item">' . $tovar_name . ' ' . implode( $terms_array, ', ' ). '</span>';
}
}
}
echo '</span>';
}
// Определяем место вывода атрибута
add_action('woocommerce_single_product_summary', 'productFeature', 7);
bloginfo('template_directory');
get_bloginfo('template_url');
get_template_directory_uri()
.single-product div.product .woocommerce-product-gallery .flex-control-thumbs {
margin: 0;
padding: 0;
display: flex;
}
<script>
$(function(){
$('a[href^="#"]').on('click', function(event) {
event.preventDefault();
var sc = $(this).attr("href"),
dn = $(sc).offset().top - 100;
$('html, body').animate({scrollTop: dn}, 1000);
});
});
</script>
$(this).addClass('currentActive');