[Resolved] Want to Reformat Date and Author

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Want to Reformat Date and Author

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3803
    Paul
    Participant

    Right now the format of date is:

    Author | Date

    What I want to format it is as

    Date by Author

    Is this possible?

    #3810
    Tom
    Keymaster

    You could try:

    1. Disabling the author output in the settings.

    2. Adding this function:

    add_filter( 'wpsp_date_output', 'tu_custom_wpsp_date_output' );
    function tu_custom_wpsp_date_output( $output ) {
        $author = sprintf(
    		'<span class="wp-show-posts-byline wp-show-posts-meta">
    			<span class="wp-show-posts-author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">
    				<a class="url fn n" href="%1$s" title="%2$s" rel="author" itemprop="url">
    					<span class="author-name" itemprop="name">%3$s</span>
    				</a>
    			</span>
    		</span>',
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		esc_attr( sprintf( __( 'View all posts by %s', 'wp-show-posts' ), get_the_author() ) ),
    		esc_html( get_the_author() )
    	);
    
    	return $output . ' by ' . $author;
    }

    Let me know 🙂

    #3812
    Paul
    Participant

    Perfect works like a champ. Legend as always!

    #3816
    Tom
    Keymaster

    Awesome! Glad I could help 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.