I'm pretty new to Wordpress Theme-development, so this might be a beginners-question. I looked everywhere for an answer, but none seems to suit my situation.

I have created a custom shop page which shows 'products' from the categorie 'guys.'

<!-- site-content -->
<div class="site-content clearfix">

    <!-- main-column -->
    <div class="main-column">

        <article class="post page">
    <h2><?php the_title(); ?></h2>


    $args = array(
        'post_type' => 'product',
        'posts_per_page' => 12,
        'product_cat' => 'guys'
    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ) {
        while ( $loop->have_posts() ) : $loop->the_post();
            get_template_part( 'shop-content', 'product' );
    } else {
        echo __( 'Sorry, no content.' );

    </div><!-- /main-column -->
    <div class="side-column">
        <?php dynamic_sidebar('sidebar1'); ?>

</div><!-- /site-content -->

The products within the loop are defined in my custom file 'shop-content.php'

My problem is: when I click one of the products displayed, it leads me to a page which displays the product like any regular blogpost. How do I change this to a custom single-product page?

  • Create a template called single-product.php. The template hierarchy should help you understand how WP decides which file to use: developer.wordpress.org/themes/basics/template-hierarchy – WebElaine Jun 11 '18 at 16:19
  • Oh wow that does the trick it's just that simple. I can't believe I didn't try this, you are my hero! – Jan Willem van Gurp Jun 11 '18 at 16:24
  • It will help if you copy that file from your ecommerce plugin, and customize from there - that way you don't have to rebuild the whole wheel. – WebElaine Jun 11 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.