admin管理员组文章数量:1410697
I'm building a theme and I've found it all pretty simple and straightforward.
However, I can't figure out why I have a totally blank page for my archive WordPress blog posts?
I understand the WordPress Hierarchy and I have a page called:
archive.php
This is my code on that page:
<?php get_header();?>
<div class="container">
<h1><?php echo single_cat_title();?></h1>
<?php if( have_posts() ): while ( have_posts() ): the_post();?>
<div class="card">
<div class="card-body">
<h3><?php the_title();?></h3>
<?php the_excerpt();?>
<a href="<?php the_permalink();?>" class="btn btn-success"> read more</a>
</div>
</div>
<?php endwhile; else: endif;?>
<?php previous_posts_link();?>
<?php next_posts_link();?>
</div>
<?php get_footer();?>
And when I view that page view a browser, i.e. my designated "blog page" in WordPress (selected in "Reading") I see nothing, totally blank, there is even no source to view.
Any idea on what (basic) error I am making here....
Thanks
I'm building a theme and I've found it all pretty simple and straightforward.
However, I can't figure out why I have a totally blank page for my archive WordPress blog posts?
I understand the WordPress Hierarchy and I have a page called:
archive.php
This is my code on that page:
<?php get_header();?>
<div class="container">
<h1><?php echo single_cat_title();?></h1>
<?php if( have_posts() ): while ( have_posts() ): the_post();?>
<div class="card">
<div class="card-body">
<h3><?php the_title();?></h3>
<?php the_excerpt();?>
<a href="<?php the_permalink();?>" class="btn btn-success"> read more</a>
</div>
</div>
<?php endwhile; else: endif;?>
<?php previous_posts_link();?>
<?php next_posts_link();?>
</div>
<?php get_footer();?>
And when I view that page view a browser, i.e. my designated "blog page" in WordPress (selected in "Reading") I see nothing, totally blank, there is even no source to view.
Any idea on what (basic) error I am making here....
Thanks
Share Improve this question asked Dec 16, 2019 at 22:05 HenryHenry 9831 gold badge8 silver badges31 bronze badges 2 |1 Answer
Reset to default 4Your designated 'blog page' (selected in 'Reading') will use the index.php file (or home.php) rather than archive.php file.
本文标签: hierarchicalArchive page showing nothingissue with WordPress Hierarchy
版权声明:本文标题:hierarchical - Archive page showing nothing - issue with WordPress Hierarchy? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744898658a2631215.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
archive.php
is not used for Pages, even if you have set one as the "blog page." Try renaming your filepage-slug.php
- i.e. if the Page is at example/my-page, the slug is "my-page", so name the filepage-my-page.php
- that way your template will apply to the Page you've created. – WebElaine Commented Dec 16, 2019 at 22:09