0
votes

My WordPress blog, which is running a custom theme, displays the date for each entry post as the same date: today. I display the last three posts on my main home page, but those dates are fine. However my main blog page shows the current date for every post.

I am able to FTP into my site, and have access to all the PHP files, the problem is I don't know which file this error might be in, whether it be index.php, page.php, single.php, I have no idea. If anyone can suggest where the problem might be, I can help by sharing that code.

Here is the 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();
2
can you add the code? - Tomás Cot
thats the problem, I don't know where that code would be....I simply hit under general -> settings to display the latest 10 posts on my page, and wordpress does it. but its displaying the dates wrong... - user3688814
try to add the index.php file, if you can, just add the part that is inside a while with a call to a have_post function - Tomás Cot
"my main blog page" - if you mean the page in which posts are displayed individually, this is likely to be "single.php". Although it is possible to fix this on the server, it is a good idea to download it locally, fix it there, and upload when you are sure it will work. - halfer
it was actually in content.php, i just had to trace all the calls and it ended up there, got it fixed!! thx for all the help - user3688814

2 Answers

1
votes

Have a look at template hierarchy chart to figure out which file is used to display those posts. It might be archive.php, front-page.php, home.php, index.php depending on the theme and setup. From there, you'll see the function or which file is loaded to display each post's content.

Considering the sample code, its probably in content.php or in case it's a special post format, in content-{format}.php

1
votes

I'm almost sure that if the theme is using Template Tags, is using the_date function, when it should be using the_timefunction.

You can read the docs for the_date, in the description there's a note you should read.