Add dynamic schema product, aggregate Rating to WooCommerce products
$raiting = wp_count_posts()->publish + 112; if($raiting==»») {return;} global $product; $img = wp_get_attachment_url( get_post_thumbnail_id($post_id), ‘thumbnail’ ); if($img==»») {$img = ‘/wp-content/uploads/2024/05/share.jpg’ ;} $title = $product->name; $descr =the_content(); $url = get_permalink(); $reviewCnt = round($raiting / 4); echo ‘ <script type=»application/ld+json»> { «@context»: «http://schema.org/», «@type»: «product», «name»: «‘ . $title . ‘», «brand»: «…», «image»: «‘ . $img . […]
Add dynamic schema product, aggregate Rating to WooCommerce products Читать далее »