0
votes

I'm loading a front-end site onto a html5blank wordpress theme. The header.php and footer.php files are working fine but my first get_template_part() section won't show up. I've looked through the template hierarchy and I can't see what could be causing the issue.

This is how I have my code -

whatwedo.php

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

        <section id="what">
              <!-- whatwedo template code -->
         </section>

index.php

<?php get_header(); ?>


        <!-- section -->
        <section>   

            <?php get_template_part('whatwedo'); ?>

        </section>
        <!-- /section -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

page-home.php

<?php get_header(); ?>
<?php get_template_part('whatwedo'); ?>

    <?php the_content(); ?>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

I'm not sure whether the template name should go in index.php or page-home.php but either way it should show up shouldn't it? I only have two pages set up in the dashboard so far - home and blog - and I'm pretty sure they're set up correctly.

Can anyone see why this might be happening?

1
As long as the template file whatwedo.php is in the child or parent theme then it should find it. I can't see any issues with your code...Andrew Schultz
@AndrewSchultz This is so frustrating. None of the templates are showing - it looks like they're there but I can't see them. Like I've got a default opacity rule somewhere that's hiding everything.Mike.Whitehead
Can you check the browser source code to see if the template is there but being hidden by a CSS rule?Andrew Schultz

1 Answers

0
votes

Try getting rid of the <?php /* Template Name: whatwedo */ ?>. That's specifically for a template, not a template part.

That part creates a new template (which can be selected from the page editor in the admin section).