Search code examples
wordpresscustom-wordpress-pages

Why isn't my single post template showing up correctly?


I'm trying to figure out how to create a custom single post template on wordpress. I'm not very familiar with it but was required to use it.

I've followed the steps required to create it but it seems that my new post template called educators is still referencing the original post template instead of the one i've created for it.

Here is my single-post_educator.php file code.

<?php get_header(); ?>
<div class="container-fluid">
    <img src="<?php the_field('post_banner','option');?>" style="width :100%;">
    <div class="container">
        <?php if (have_posts()) :
        while (have_posts()) : the_post(); ?>
        <?php if( get_field('post_content_right') ) { ?>
            <div class="post-right col-sm-6 col-xs-12">
                <h2><?php echo get_the_title();?></h2>
                <p><?php echo the_field('post_content');?></p>
        </div>
        <div class="col-sm-6 col-xs-12 post-right">
            <a href="<?php echo home_url();?>/#educator" style="font-size: 
            15px;color:#000000;float:right;font-family: 'calibri';text-
            decoration: underline;text-align:right;">Back</a>

                <p><?php echo the_field('post_content_right');?></p>
        </div>
        <?php } else { ; ?>
        <div class="post-right col-sm-6 col-xs-12">
            <a href="<?php echo home_url();?>/#educator" style="font-size: 
            15px;color:#000000;float:right;font-family: 'calibri';text-
            decoration:underline;text-align:right;">Back</a>

            <h2><?php echo get_the_title();?></h2>
            <p><?php echo the_field('post_content');?></p>
        </div>
        <?php } ;?>
        <?php
        endwhile;
        endif; ?>
    </div>
</div>
<?php get_footer(); ?>

I included a photo of how it currently is and how i actually want it to be like:

my question

Thanks in advance.. help is much appreciated


Solution

  • The file should be named:

    single-{post_type}.php
    

    So in your case it should be

    single-post_educators.php
    

    You're missing the s