The posts on my custom theme are using the index.php
file instead of single.php
_ I have looked through at least 10 questions on SO_ although many of them are very old _
Some answers said that if the WP loop isn't set up in single.php
then it won't be called _ BUT my single.php file does contain the loop _
<?php get_header(); ?>
<div class="container fadeIn" id="perimeter">
<section id="page">
<div class="row">
<div class="col-12">
<div class="divPad">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php echo wpautop('Sorry, no posts were found'); ?>
<?php endif; ?>
</div>
</div>
</div>
</section>
<div class="horizBuffer2"></div>
</div><!-- /#perimeter -->
<?php get_footer(); ?>
One answer appears on several questions and judging from the spelling and other idiosyncrasies has clearly been copy/pasted _ It says something about changing permalinks in the WP dashboard Settings section _ but it doesn't explain clearly what should be changed _
IMPORTANT: This custom theme does NOT have a blogroll page _ All posts are sent to different pages via their categories _
Thanks in advance to anyone who can get my posts to display on single.php
The posts on my custom theme are using the index.php
file instead of single.php
_ I have looked through at least 10 questions on SO_ although many of them are very old _
Some answers said that if the WP loop isn't set up in single.php
then it won't be called _ BUT my single.php file does contain the loop _
<?php get_header(); ?>
<div class="container fadeIn" id="perimeter">
<section id="page">
<div class="row">
<div class="col-12">
<div class="divPad">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php echo wpautop('Sorry, no posts were found'); ?>
<?php endif; ?>
</div>
</div>
</div>
</section>
<div class="horizBuffer2"></div>
</div><!-- /#perimeter -->
<?php get_footer(); ?>
One answer appears on several questions and judging from the spelling and other idiosyncrasies has clearly been copy/pasted _ It says something about changing permalinks in the WP dashboard Settings section _ but it doesn't explain clearly what should be changed _
IMPORTANT: This custom theme does NOT have a blogroll page _ All posts are sent to different pages via their categories _
Thanks in advance to anyone who can get my posts to display on single.php
1 Answer
Reset to default 0single.php
will only display a single post on the other hand index.php
is the default template that displays everything including posts
, post
, page
, categories
, and tags
only if specific template file is not present.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745245152a4618377.html
index.php
? – Sally CJ Commented Aug 13, 2019 at 22:46