0

I'm using WooCommerce and it created a page called "Shop" which I've attributed to my custom template "Store" through the "page attributes" module in the dashboard.

<?php
/*
Template Name: Store
*/
?>

        <?php get_header();?>

            <section id="content">

                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                <div class="article-wrapper">
                    <span class="top-left-corner"></span>
                    <span class="top-right-corner"></span>
                    <article id="post-<?php the_ID(); ?>">
                        <span class="top-corners"></span>
                        <h2><?php the_title(); ?></h2>
                        <section class="entry">
                            <?php the_content(); ?>
                        </section>
                        <span class="bottom-corners"></span>
                    </article>
                    <span class="bottom-left-corner"></span>
                    <span class="bottom-right-corner"></span>
                </div>

                <?php endwhile; else: ?>

                <p>Sorry, no posts matched your criteria.</p>

                <?php endif; ?>

            </section>

        <?php get_footer(); ?>

However, for some reason, WordPress keeps fetching the archive page instead of my custom Store page.

This is what the body class looks like: <body class="archive post-type-archive post-type-archive-product logged-in woocommerce woocommerce-page infinite-scroll neverending">

I'm aware of the issue that the slug cannot match a custom post type with the same name and I've made sure of that. I don't have any custom post types at all. I've double-checked this by changing the name of the page slug and the custom template to something random and still WordPress pulls the archive page.

What could be causing this issue?

2 Answers 2

1

WooCommerce uses a custom post type called product for its product. Your shop page appears to be looking for a products archive. I can tell this because of the slug - post-type-archive-product

Have you tried renaming your custom shop template file archive-product.php? This should override the default archive template.

2
  • I just tried renaming the custom template to archive-product.php. Didn't work. So I tried removing the top header info (i.e. <?php /* Template Name: Store */ ?>). That didn't work either.
    – Desi
    Commented Jul 10, 2014 at 22:59
  • Actually, you were right. Looks like I had to override the template by creating my own woocommerce folder as stated in the woocommerce template: "Override this template by copying it to yourtheme/woocommerce/archive-product.php"
    – Desi
    Commented Jul 11, 2014 at 1:14
-1

Please set the template to Default template in the page edit. enter image description here

Thanks, sharma Chelluri

1
  • If I do this, then it just goes back to using the default template. I'm trying to use a custom template.
    – Desi
    Commented Jul 10, 2014 at 23:30

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.