- This topic has 7 replies, 2 voices, and was last updated 3 years, 4 months ago by David.
-
AuthorPosts
-
December 21, 2020 at 6:30 am #1589184Johnson
Hey,
Trust you’re good and doing well!
I want to change the entry meta of each blog post to this form:
By (author gravatar) Author Name / Last Updated: Mar 24, 2016
Any help would be much appreciated!
Thanks!
JohnsonDecember 21, 2020 at 7:28 am #1589470DavidStaffCustomer SupportHi there,
try adding this PHP Snippet:
add_filter( 'generate_post_author_output', function() { return sprintf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), get_avatar( get_the_author_meta( 'ID' ) ) ) ); } ); add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'date', ); } );
Adding PHP: https://docs.generatepress.com/article/adding-php/
And then add this CSS:
.byline img { width: 25px; height: 25px; border-radius: 50%; position: relative; vertical-align: middle; margin: 0 10px 0 0; } .posted-on { border-left: 1px solid #ddd; padding-left: 10px; margin-left: 10px; }
December 21, 2020 at 7:53 am #1589517JohnsonHey David,
Thank you for your quick support.
The author gravatar is a square as you can see from my website (offered in private information). Please offer a circular gravatar
And could you please make it in this form:
By (author gravatar) Author Name / Last Updated: Mar 24, 2016
Thank you very much!
JohnsonDecember 21, 2020 at 8:03 am #1589534DavidStaffCustomer SupportI just checked and the Avatar is round – maybe try clearing the browser cache.
Now to update the date add this PHP snippet:
add_filter( 'generate_post_date_show_updated_only', '__return_true' ); add_filter( 'generate_post_date_output','tu_add_to_post_date' ); function tu_add_to_post_date( $output ) { return ' | Last updated: ' . $output; }
December 21, 2020 at 8:09 am #1589541JohnsonThanks David! The gravatar is wonderful!
Could you please help add “Last Updated” behind the “|”
December 21, 2020 at 8:40 am #1589596DavidStaffCustomer SupportOops sorry – remove this CSS:
.posted-on { border-left: 1px solid #ddd; padding-left: 10px; margin-left: 10px; }
And i have updated the PHP snippet here to include the
|
https://generatepress.com/forums/topic/edit-enty-meta/#post-1589534
December 21, 2020 at 6:21 pm #1590010JohnsonThank you so much David! You’re a genius!
December 22, 2020 at 1:57 am #1590301DavidStaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.