• sarkarialerteam

    (@sarkarialerteam)


    Hi, i wanted to show both post published and post modified date.

    i followed your instruction on how to show modified date but it removed my published date.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am also looking for this. I want to show post published time and then Post Last modified time. I got this work with a plugin. But it’s just make my sute heavy. So any solution without pluging will be helpful.

    Thread Starter sarkarialerteam

    (@sarkarialerteam)

    i am also looking for it.

    Hi @sarkarialerteam,

    We are sorry for the delay.

    Actually, we don’t provide custom code as it is beyond our support and usually will let the community takes the part.

    However, I would like to consider this as a one-time exception. Please try the following

    function your_prefix_post_date( $output ) {
    	$format        = apply_filters( 'astra_post_date_format', '' );
    	$modified_date = esc_html( get_the_modified_date( $format ) );
    	$modified_on   = sprintf(
    		esc_html( '%s' ),
    		$modified_date
    	);
    	$updated_output = '';
    	$separator = ' /';
    	$separator = apply_filters( 'astra_post_meta_separator', $separator );
    	$published_string = __('Published : ' , 'astra');
    	$updated_string = __('' . $separator . ' Updated : ' , 'astra' );
    	$updated_output       .= '';
    	$updated_output       .= ' ' . $modified_on . '';
    	$updated_output       .= '';
    	$modified_output = $published_string . $output . $updated_string . $updated_output;
    	return $modified_output;
    }
    add_filter( 'astra_post_date', 'your_prefix_post_date' );

    I hope it will help.

    Kind regards,
    Herman ??

    Thanks herman bro. I have child theme installed. So i am gonna paste this code on child theme function file right?

    Hello @tvhex

    Correct, you can try adding the code here – https://wpastra.com/docs/add-custom-php-code/#3.-in-child-theme

    Hope that helps!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to show Post Published and Modified Date’ is closed to new replies.