I have a template set up and I’ve created a page in WordPress and have chosen the corresponding template in the drop down. I have created templates for several pages of this site and they’ve all worked fine; however, this one template is causing problems. WordPress keeps fetching the archive page for some reason. The exact body class is this: archive post-type-archive post-type-archive-teams logged-in

Here is the template I’ve created.

        <?php get_header();?>

            <section id="content">

                <?php
                    $temp = $wp_query;
                    $wp_query = null;
                    $wp_query = new WP_Query();
                    $wp_query->query('post_type=teams&posts_per_page=7');

                    while ( $wp_query->have_posts() ) : $wp_query->the_post();

                ?>

                <article class="post team" id="post-<?php the_ID(); ?>">
                    <h2><?php the_title(); ?></h2>
                    <section class="entry">
                                      content here
                    </section>
                </article>

                <?php
                    endwhile; 
                    $wp_query = null;
                    $wp_query = $temp;
                    wp_reset_query();
                ?>
            </section>

        <?php get_sidebar(); ?>

        <?php get_footer(); ?>

Can someone help me out in figuring out why this isn’t working?

2 Answers
2

My issue was research was not using page-research.php but instead using archive.php

I resolved it not by the “Static Pages and Custom Post Types cannot have the same slug” solution, but on the dashboard in Settings -> Permalinks.

It was on “Day and name” and I changed it to “Numeric” and the research page loaded from page-research.php

Leave a Reply

Your email address will not be published. Required fields are marked *