WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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! :)

share|improve this question
Replace the curly quotes in ‘banner’ and other occurrences with simple quotes '. – toscho Dec 3 '13 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. :( – Miss_Scarlett80 Dec 3 '13 at 19:45
Next step: Read this thread. – toscho Dec 3 '13 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. – ialocin Dec 3 '13 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! – Miss_Scarlett80 Dec 3 '13 at 21:05
up vote 2 down vote accepted

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"]'); ?>
share|improve this answer
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! :) – Miss_Scarlett80 Dec 3 '13 at 20:50
the [product] shortcode does that :) – webaware Dec 3 '13 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! – Miss_Scarlett80 Dec 3 '13 at 21:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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