【问题标题】:WordPress Blog Won't Display Post Title, Meta Data, or CommentsWordPress 博客不会显示帖子标题、元数据或评论
【发布时间】:2017-06-28 02:55:39
【问题描述】:

我确信这是一个简单的修复,但我不是一个程序员。

3 或 4 年前,我为我的一位客户编写了一个 WordPress 网站。他们要求将博客添加到他们的网站。

发生了几件奇怪的事情,我不完全确定为什么。

如果你去:http://firstcalliowa.com/blog/

您可以看到它没有显示帖子标题或元数据。只是帖子内容。

另外,请转至:http://firstcalliowa.com/author/austinhudspeth/

所以,这很有趣。在这里,您可以看到帖子标题并编辑此链接。帖子标题未链接,但可以修复。有趣的是,我还没有制作作者文件。所以,我不确定为什么它在这里看起来更正确,但不会在第一个链接上拉起帖子标题。

这是我的循环代码:

`   <div id="content">
        <div id="content_container">

       <!-- Start the Loop. -->
 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

 <!-- Test if the current post is in category 3. -->
 <!-- If it is, the div box is given the CSS class "post-cat-three". -->
 <!-- Otherwise, the div box is given the CSS class "post". -->

 <?php if ( in_category('3') ) { ?>
           <div class="post-cat-three">
 <?php } else { ?>
           <div class="post">
 <?php } ?>


 <!-- Display the Title as a link to the Post's permalink. -->

 <h2><?php the_title(); ?></h2>


 <!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->

 <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>


 <!-- Display the Post's content in a div box. -->

 <div class="entry">
   <?php the_content(); ?>
 </div>


 <!-- Display a comma separated list of the Post's Categories. -->

 <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
 </div> <!-- closes the first div box -->


 <!-- Stop The Loop (but note the "else:" - see next line). -->

 <?php endwhile; else: ?>


 <!-- The very first "if" tested to see if there were any Posts to -->
 <!-- display.  This "else" part tells what do if there weren't any. -->
 <p>Sorry, no posts matched your criteria.</p>


 <!-- REALLY stop The Loop. -->
 <?php endif; ?>
</div>`

【问题讨论】:

  • 另外,如果你去这里:firstcalliowa.com/sample-blog-post 你会看到 COMMENTS 标题为红色。这应该正在加载 Facebook cmets。虽然不是。我尝试了 4 或 5 个不同的 Facebook 评论插件,但没有一个显示。我猜这是一个类似的相关问题,因为一切都与不显示有关。任何帮助将不胜感激!

标签: wordpress


【解决方案1】:

在您提供的第一个链接上,您提供的 HTML 似乎没有被使用。您可以进行测试编辑以确保 /blog 页面实际上正在使用您创建的循环吗?我看到一个空的 .post-header div 正在输出,但我在循环中的任何地方都看不到它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-07
    • 2015-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多