Use modified time instead of published for articles

Hey there folks,

How do I change the published Date of articles to use the modified time of an article?

So, for instance:

I write an Article on April, 1. I update this Article on April, 2.

For now, it says: From April, 1.

But I want it to always show the date updated, so it says

From April, 2.

Can you help me?

Hi examo, If you are using the rtPanel Child Theme to make modifications to your rtPanel Theme Framework, the following steps should suffice.

  1. Open your /lib/rtp-custom-hooks-applied.php file

  2. Locate the first funtion rtp and uncomment the following lines in it.

    remove_action( 'rtp_hook_post_meta_top','rtp_default_post_meta' ); // Post Meta Top  
    remove_action( 'rtp_hook_post_meta_bottom','rtp_default_post_meta' ); // Post Meta Bottom`  
    
  3. Then add the following lines right after that

    add_action( 'rtp_hook_post_meta_top','rtp_child_default_post_meta' ); // Post Meta Top  
    add_action( 'rtp_hook_post_meta_bottom','rtp_child_default_post_meta' ); // Post Meta Top`  
    
  4. Go to the end of the file and paste the following function

    rtp_child_default_post_meta( $placement = 'top' ) {  
    
    if ( 'post' == get_post_type() && !rtp_is_bbPress() ) {  
        global $post, $rtp_post_comments;  
        $position = ( 'bottom' == $placement ) ? 'l' : 'u'; // l = Lower/Bottom , u = Upper/Top  
    
        if ( rtp_has_postmeta( $position ) ) {  
            if ( $position == 'l' ) { echo ''; } ?>  
            
    <?php if( 'bottom' == $placement ) rtp_hook_begin_post_meta_bottom(); else rtp_hook_begin_post_meta_top(); // Author Link if ( $rtp_post_comments['post_author_'.$position] || $rtp_post_comments['post_date_'.$position] ) { ?>

    <?php if ( $rtp_post_comments['post_author_'.$position] ) { printf( __( 'Posted by %s', 'rtPanel' ), ( !$rtp_post_comments['author_link_'.$position] ? get_the_author() . ( $rtp_post_comments['author_count_'.$position] ? '(' . get_the_author_posts() . ')' : '' ) : sprintf( __( '%3$s', 'rtPanel' ), get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ), esc_attr( sprintf( __( 'Posts by %s', 'rtPanel' ), get_the_author() ) ), get_the_author() ) . ( $rtp_post_comments['author_count_'.$position] ? '(' . get_the_author_posts() . ')' : '' ) ) ); } echo ( $rtp_post_comments['post_author_'.$position] && $rtp_post_comments['post_date_'.$position] ) ? ' ' : ''; if ( $rtp_post_comments['post_date_'.$position] ) { printf( __( 'on %s', 'rtPanel' ), get_the_modified_date('c'), get_the_modified_time( $rtp_post_comments['post_date_format_'.$position] ) ); } ?>

    <?php } // Post Categories echo ( get_the_category_list() && $rtp_post_comments['post_category_'.$position] ) ? '

    ' . __( 'in', 'rtPanel' ) . ' ' . get_the_category_list( ', ' ) . '

    ' : ''; // Post Tags echo ( get_the_tag_list() && $rtp_post_comments['post_tags_'.$position] ) ? '

    ' . get_the_tag_list( __( 'Tagged', 'rtPanel' ) . ': ', ', ', '' ) . '

    ' : ''; // Post Custom Taxonomies $args = array( '_builtin' => false ); $taxonomies = get_taxonomies( $args, 'objects' ); foreach ( $taxonomies as $key => $taxonomy ) { ( get_the_terms( $post->ID, $key ) && isset( $rtp_post_comments['post_'.$key.'_'.$position] ) && $rtp_post_comments['post_'.$key.'_'.$position] ) ? the_terms( $post->ID, $key, '

    ' . $taxonomy->labels->singular_name . ': ', ', ', '

    ' ) : ''; } if ( 'bottom' == $placement ) rtp_hook_end_post_meta_bottom(); else rtp_hook_end_post_meta_top(); ?>
    <?php if ( $position == 'l' ) { echo ''; } } } elseif ( !rtp_is_bbPress() ) { if ( get_edit_post_link() && ( 'top' == $placement ) ) { ?>
    <?php rtp_hook_end_post_meta_top(); ?>
    <?php } } }

Now incase you are using the rtPanel Theme Framework itself to modify your theme ( not recommended ). You would need to locate /lib/rtp-default-functions.php and find the function rtp_default_post_meta and replace the contents of the function with the contents of the function from step no. 4 above.

This should do the trick. Let me know if this helps.

Thanks Joshua,

That is the way I wanted it to work!