permalinks - WP posts using index.php instead of 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 que

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

Share Improve this question edited Aug 13, 2019 at 21:09 inputforcolor asked Aug 13, 2019 at 21:02 inputforcolorinputforcolor 1271 silver badge11 bronze badges 5
  • 1 Are you sure that the template being used is indeed index.php ? – Sally CJ Commented Aug 13, 2019 at 22:46
  • hi Sally _ very happy to see you cos you helped me out once before with with a bootstrap 4 modal : ) – inputforcolor Commented Aug 13, 2019 at 22:55
  • this is the URL to a post which I want to show up in the single.php so that I can style the page >>> lilyrigby/index.php/2019/08/12/hughie-odonoghue – inputforcolor Commented Aug 13, 2019 at 22:55
  • 1 Yeah, I'm glad to see you've got it sorted already. :) – Sally CJ Commented Aug 13, 2019 at 23:23
  • 1 Good to see you again @SallyCJ _ thanks for showing up : ) – inputforcolor Commented Aug 13, 2019 at 23:24
Add a comment  | 

1 Answer 1

Reset to default 0

single.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

相关推荐

  • permalinks - WP posts using index.php instead of 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 que

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信