I am currently learning PHP & how to customize Wordpress.

I have a shop that I set up on Wordpress using the Woocommerce plugin. The shop holds only a single item. Since I only have 1 item to sell, I would like to show the product on my homepage in such a fashion where the complete product page is shown on the homepage.

Here is some code i've been trying to get to work (this is placed in the home.php file):

$prodpage = array(
'post_type' => 'product',
'posts_per_page' => 1,
'taxonomy' => 'banner',
'term' => 'banner'
$featured_query = new WP_Query( $prodpage );

if ($featured_query->have_posts()) :   

    while ($featured_query->have_posts()) :   


        $product = get_product( $featured_query->product->ID );  

    // Product Info Output Here



wp_reset_query(); // Query Reset

I have also tried using query_posts in this manner:

if ( is_home() ) {
query_posts( 'p=31' );

The good news is that I don't get flagged for any syntax errors. The bad news is that I am afraid my logic is off somewhere as I get a page with only the WP header and footer. The mid section where the product should show up is not showing up.

I really appreciate any guidance you guys are able to give! :)

  • Replace the curly quotes in ‘banner’ and other occurrences with simple quotes '.
    – fuxia
    Commented Dec 3, 2013 at 19:06
  • Thank you for catching that!! I took out the curly quotes as directed. Unfortunately, that didn't enable the information to show up. :( Commented Dec 3, 2013 at 19:45
  • Next step: Read this thread.
    – fuxia
    Commented Dec 3, 2013 at 19:47
  • 'term' doesn't exist as parameter for WP_Query, it should be 'terms'. Besides that, it should be part of a 'tax_query'; the 'taxonomy' parameter too. But because you only have and want one product there is no sense in that, you don't need it. Commented Dec 3, 2013 at 20:42
  • Thank you both! I am reading up on queries now. Great information in the article you posted, toscho! I was going back and forth between the Wordpress Codex and PHP manual but wasn't 100% solid in my understanding. The link you posted helped fill in the gap! Thank you! Commented Dec 3, 2013 at 21:05

1 Answer 1


Why not just use the product_page shortcode?

In the page content:

[product_page id="31"]

In code in the home page template:

<?php echo do_shortcode('[product_page id="31"]'); ?>
  • Wow! Thank you! I came across that method in my search but felt (read assumed) that it would only pull up the thumbnail and add-to-cart button. Yeah... assumptions. Sheesh. Again, Thank you! :) Commented Dec 3, 2013 at 20:50
  • the [product] shortcode does that :)
    – webaware
    Commented Dec 3, 2013 at 20:52
  • I tried that but it only showed the thumbnail and an add-to-cart button. The code snippet you provided for the manual shortcode actually showed the complete product page. I wonder if all I needed to do was put [product_page id="31"] in my Wordpress post. Would the complete page have showed up then? Off to test! Commented Dec 3, 2013 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.