• Hello.

    I would like to include content from a post displayed above my products pages.

    I put the following code into my archive-product.php file, which I copied into my child-theme (using Twenty Twelve).

    <?php
    global $more;
    $more = 0;
    query_posts('cat=37');
    if(have_posts()) :
    while(have_posts()) :the_post();
    ?>
    <h2><a>"><?php the_title();?></a></h2>
    <div><?php the_content('Read More') ?></div>
    <?php
    endwhile;
    endif;
    wp_reset_query();?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    As you know, this is displaying the content of the post from a particular category.

    But here is the issue.

    I want each of my product pages to display content from a different post/different category.

    Could you please let me know if there is a way to do this.

    I thought I could duplicate the archive-product page for each category (Mens, Shoes, Boots etc.) and just change the code above to suit… but I presume that is not efficient or even possible.

    Thanks
    Joe

Viewing 4 replies - 1 through 4 (of 4 total)
  • If this is a secondary query/Loop, then you shouldn’t be using query_posts(). Use WP_Query() instead.

    As for displaying different category content for each page, what links the page and the category?

    Thread Starter joecoll

    (@joecoll)

    Thank you for the speedy and useful reply esmi!

    Not sure that I follow re what links the page and the category.

    In Woocommerce, I created my categories: Mens (parent), Boots, Shoes etc. as children.
    Then using the Appearance > Menu, I inserted the categories creating the pages on my site.

    Then I went into Posts > Categories and created new categories eg; mens-featured which as an id of 37.

    So I want to have the mens-featured post appear on my Mens page, boots-featured appear on my Boots page etc.

    Hope that is clear… I’m a newbie!

    I’m running a local install, but could put the site live if you would like to view the site?

    Thanks
    Joe

    For specific support for Woocommerce, you need to post in http://wordpress.org/support/plugin/woocommerce

    Thread Starter joecoll

    (@joecoll)

    Ok thanks, will do

    J

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce: Post above products pages’ is closed to new replies.