Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #110474
    FalkR1979
    Participant

    Hi there,

    wondering if it’s possible to display the time when a post was published in the articles entry-meta.

    If it is: how can it be realized?

    #110513
    Mahesh
    Participant

    @falkr1979: Yes, this can be done. For that, you’ll need to create a child theme. You can find more details on creating child theme HERE. Then in your child theme’s functions.php add the following codes.

    function catchevolution_posted_on() {
    	/* Check Author URL to Support Google Authorship
    	*
    	* By deault the author will link to author archieve page
    	* But if the author have added their Website in Profile page then it will link to author website
    	*/
    	if ( get_the_author_meta( 'user_url' ) != '' ) {
    		$catchevolution_author_url = 	esc_url( get_the_author_meta( 'user_url' ) );
    	}
    	else {
    		$catchevolution_author_url = esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) );
    	}
    	printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date updated" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'catch-evolution' ),
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date( 'F j, Y g:i A' ) ),
    		$catchevolution_author_url,
    		esc_attr( sprintf( __( 'View all posts by %s', 'catch-evolution' ), get_the_author() ) ),
    		get_the_author()
    	);
    }

    Regards,
    Mahesh

    #110587
    FalkR1979
    Participant

    Thumbs up! That did the job. Just had to implement some adjustments due to localization.

    Thank you !!!

    #110706
    Mahesh
    Participant

    @falkr1979: Thank you for your appreciation. Have a nice day!

    Regards,
    Mahesh

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘publishing time in entry-meta’ is closed to new replies.