function print_root_category() {
if ( ! is_single() ) {
return;
}
$post_categories = wp_get_post_categories( get_the_ID(), [ 'fields' => 'all' ] );
if ( ! count( $post_categories ) ) {
return;
}
$post_category = $post_categories[0];
if ( ! $post_category->parent ) {
return;
}
$parents = get_ancestors( $post_category->term_id, $post_category->taxonomy );
$root_category_id = array_pop( $parents );
echo 'Смотрите так же <a href="' . get_category_link( $root_category_id ) . '">' . get_cat_name( $root_category_id ) . '</a>';
}
echo '<input type="text" id= "lft_new_field" name="lft_new_field" value="Ex:14" size="25" />';
echo '<input type="text" id= "lft_new_field" name="lft_new_field" value="' . get_post_meta( $post->ID, '_my_meta_value_key', true ) . '" size="25" />';
$default_category_id = get_option( 'default_product_cat', 0 );
if ( is_tax( 'product_cat', $default_category_id ) ) {
echo 'Default Category!';
}
add_filter('pre_get_posts',function($filter) use ($file) {
return exc_post($filter, $file);
});
add_filter('pre_get_posts','exc_post', function($filter) use ($file) {
return exc_post($filter, $file);
});
$date = new DateTime('2000-01-01');
echo $date->format('F Y');
add_action( 'wp_enqueue_scripts', 'spon_style', 100 );
https://realia.ua/prodazha-kvartir/room-2/type_object-ctudiya-2_h_i_bolee_urovnej/area-ot-25/cost-ot-500000/
<?php
global $product;
if ( 'no' === get_option( 'woocommerce_enable_review_rating' ) ) {
return;
}
$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average = $product->get_average_rating();
if ( $rating_count > 0 ) : ?>
<div class="woocommerce-product-rating">
<?php echo wc_get_rating_html( $average, $rating_count ); ?>
<?php echo '(' . $review_count . ')'; ?> <!-- Количество отзывов -->
</div>
<?php endif; ?>