Can we hide published date when showing last update


#1

hello friends,
I want to know Can we hide published date when showing last update .


#2

Change Publish Date to Last Updated

// Show Last updated Date in the Entry meta
function post_modified_date() {
    return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );

Bonus: Show Recently updated article first

// Sort posts by Last Modified
function modified( $query )
{
    if ( $query->is_main_query() && ( $query->is_home() || $query->is_search() || $query->is_archive() )  )
    {
        $query->set( 'orderby', 'modified' );
        $query->set( 'order', 'desc' );
    }
}
add_action( 'pre_get_posts', 'modified' );

#3

How can we show last update date on pages (not posts) in wordpress.


#4

WordPress by default doesn’t show any entry meta for page, only for post.


#5

thanks sir


#6

You’re welcome!