首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的WordPress博客帖子没有显示?

为什么我的WordPress博客帖子没有显示?
EN

Stack Overflow用户
提问于 2020-05-01 01:38:30
回答 1查看 45关注 0票数 0

我正在与一个博客页面自定义可湿性粉剂主题。博客页面显示了帖子,但当您单击每个帖子时,它会将您带到一个空页面。

我已经设置了:设置>发布页面>博客

基本上,博客页面显示所有内容,但博客帖子页面是空白的。这是我的index.php

代码语言:javascript
复制
<div class="header-img-container container-fluid">
    <img 
    class="header-img" 
    role="banner" 
    src="http://cc.local/wp-content/uploads/2020/04/blog-page.jpg"  
    >
    <hr class="horizontal-line">

</div>

<div class="container">
    <div class="row">
            <div class="col">

                <div class="vertical-center">
                    <form action="http://cc.fullslate.com/">
                        <button class="appointment-button btn button">Schedule</button>
                    </form>
                </div>
                <p class="page-body-title">Blog</p>
                <div id="primary" class="content-area">
                    <main id="main" class="site-main">

                    <?php
                    if ( have_posts() ) {

                        // Load posts loop.
                        while ( have_posts() ) {
                            the_post();
                            get_template_part( 'template-parts/content/content' );
                        }

                        // Previous/next page navigation.
                        //cc_the_posts_navigation();

                    } else {

                        // If no content, include the "No posts found" template.
                        get_template_part( 'template-parts/content/content', 'none' );

                    }
                    ?>

                    </main><!-- .site-main -->
                </div><!-- .content-area -->
            </div>
    </div>
</div>
EN

回答 1

Stack Overflow用户

发布于 2020-05-02 03:44:11

如果你想编辑单个帖子的视图,你需要在wordpress:https://developer.wordpress.org/themes/basics/template-hierarchy/中使用single.php查找更多关于模板层次的信息

下面是它应该是什么样子:https://developer.wordpress.org/themes/template-files-section/post-template-files/

您可以根据需要调整此single.php,它将按原样工作,因为其中包含post循环。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61529478

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档