• Resolved waywrdsmeansgns

    (@waywrdsmeansgns)


    Hi,

    I recently figured out how to change the default ‘Post last updated’ text to show when the post was originally created. Thought I’d share this with others.

    Solution best done with a child theme. This *might* work for people working on other themes, note you would just replace givingpress-lite with your theme name

    To change the date on the post itself, go to loop-post.php and find this code
    <p><i class="fa fa-clock-o"></i> <?php givingpress_lite_posted_on(); ?></p>

    and replace it with

    <p><i class="fa fa-clock-o"></i> <?php esc_html_e( 'Posted on', 'givingpress-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'givingpress-lite' ) ); ?></p>
    

    Now this will only change it on the post itself, so you need to make similar changes in loop-archive.php, loop-blog.php and loop-category.php to modify the tag, and blog, and category pages.

    Now the only issue with this is that it also removes the author name, which you might want to retain. Can anyone figure out how to do that? Edit: see final post for solution!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter waywrdsmeansgns

    (@waywrdsmeansgns)

    Similar solution for Archive display, and this DOES retain the author name. But the original code is a bit different. In the loop-archive.php file:

    Find

    <?php if ( get_the_modified_time() != get_the_time() ) { ?>
    				<?php esc_html_e( 'Updated on', 'givingpress-lite' ); ?> <?php the_modified_date( esc_html__( 'F j, Y', 'givingpress-lite' ) ); ?>

    and replace with

    <?php if ( get_the_modified_time() != get_the_time() ) { ?>
    				<?php esc_html_e( 'Posted on', 'givingpress-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'givingpress-lite' ) ); ?>
    Thread Starter waywrdsmeansgns

    (@waywrdsmeansgns)

    SOLUTION!

    This appears to be a solution that retains the author name and the original post date. Seems to work in all the files.

    		<p class="align-left"><i class="fa fa-clock-o"></i>
    			<?php if ( get_the_modified_time() != get_the_time() ) { ?>
    				<?php esc_html_e( 'Posted on', 'givingpress-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'givingpress-lite' ) ); ?>
    			<?php } else { ?>
    				<?php esc_html_e( 'Posted on', 'givingpress-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'givingpress-lite' ) ); ?>
    			<?php } ?>
    			<?php esc_html_e( 'by', 'givingpress-lite' ); ?> <?php esc_url( the_author_posts_link() ); ?>
    		</p>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing ‘last updated’ to original post date’ is closed to new replies.