为什么我的单个 post 模板没有正确显示?
Why isn't my single post template showing up correctly?
我正在尝试弄清楚如何在 wordpress 上创建自定义单个 post 模板。我对它不是很熟悉,但必须使用它。
我已按照创建它所需的步骤进行操作,但我的名为 educators 的新 post 模板似乎仍在引用原始 post 模板,而不是我为其创建的模板.
这是我的单post_educator.php文件代码。
<?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(); ?>
我附上了一张照片,展示了它目前的样子以及我真正希望它是什么样的:
提前致谢..非常感谢帮助
文件应命名为:
single-{post_type}.php
所以你的情况应该是
single-post_educators.php
你错过了 s
我正在尝试弄清楚如何在 wordpress 上创建自定义单个 post 模板。我对它不是很熟悉,但必须使用它。
我已按照创建它所需的步骤进行操作,但我的名为 educators 的新 post 模板似乎仍在引用原始 post 模板,而不是我为其创建的模板.
这是我的单post_educator.php文件代码。
<?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(); ?>
我附上了一张照片,展示了它目前的样子以及我真正希望它是什么样的:
提前致谢..非常感谢帮助
文件应命名为:
single-{post_type}.php
所以你的情况应该是
single-post_educators.php
你错过了 s