【发布时间】:2014-09-09 17:22:09
【问题描述】:
运行自定义主题的我的 WordPress 博客将每个条目帖子的日期显示为同一日期:今天。我在我的主页上显示最后三个帖子,但这些日期很好。但是,我的主博客页面显示了每篇文章的当前日期。
我能够通过 FTP 进入我的站点,并且可以访问所有 PHP 文件,问题是我不知道这个错误可能在哪个文件中,无论是 index.php、page.php 还是单个。 php,我不知道。如果有人能提出问题可能出在哪里,我可以通过分享该代码来提供帮助。
这里是 index.php
<?php
get_header(); ?>
<div class="wrap blog">
<h1>Blog</h1>
<div class="blog-left">
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
// Include the featured content template.
get_template_part( 'featured-content' );
}
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
// Previous/next post navigation.
twentyfourteen_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
</div>
<div class="blog-right">
<?php get_sidebar(); ?>
</div>
</div>
<?php
get_footer();
【问题讨论】:
-
可以加代码吗?
-
这就是问题所在,我不知道那个代码会在哪里......我只是点击了常规 -> 设置以在我的页面上显示最新的 10 个帖子,wordpress 就可以了。但它显示的日期错误...
-
尝试添加
index.php文件,如果可以,只需添加while内的部分并调用have_post函数 -
“我的主博客页面” - 如果您指的是单独显示帖子的页面,这很可能是“single.php”。虽然可以在服务器上修复此问题,但最好在本地下载、修复,然后在确定可以正常工作时上传。
-
它实际上在 content.php 中,我只需要跟踪所有的调用,它就到了那里,得到了修复!!感谢所有的帮助
标签: php html wordpress date blogs