Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14625 reviews 1734 hosting providers

Questions & Answers

Display products on home page only

Mar 12, 2013 by SunFun
Hi
 I am using woocommerce with a child theme, for  my catalog. There is a shortcode available in woocommerce for displaying featured products. I want the featured products to display on my static home page only. I tried using this code
<?php echo do_shortcode('[featured_products per_page="10" columns="5"]'); ?>
but the above code displayed the featured products on all my pages.
I would appreciate any suggestions on this matter,
thank you

1 Answer

0 votes
Mar 12, 2013 by expert
Try adding a condition like this:
<?php
if( is_front_page() ) {
echo do_shortcode('[featured_products per_page="10" columns="5"]');
}
?>