- This topic has 52 replies, 3 voices, and was last updated 1 year, 3 months ago by David.
-
AuthorPosts
-
July 2, 2020 at 12:02 am #1349042Ravi Saive
Hi Team,
I want to show the only author’s image, name, and date as shown in this example: https://prnt.sc/ta8w59.
I also added an example link in the URL here: http://maxify.themerex.net/home-2/
July 2, 2020 at 5:56 am #1349345DavidStaffCustomer SupportHi there,
as per your other topic – can you create a staging site so we can see what you have already – then we can assist with making these changes.
January 3, 2023 at 12:04 am #2481500Ravi SaiveI just want to display the author’s image with name and date at the right and comment count on the left side of the homepage posts…
See the information in the private..
January 3, 2023 at 12:33 am #2481525Fernando Customer SupportHi Ravi,
Can you try adding this Snippet first?:
add_filter('generate_header_entry_meta_items', function($output){ if(is_home() || is_archive() ){ return array( 'author', 'date', 'comments-link' ); } return $output; }, 10); add_filter( 'generate_post_author_output', 'tu_add_author_gravatar' ); function tu_add_author_gravatar() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%5$s<a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>', __( 'by','generatepress'), 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_action( 'wp', function() { if ( is_home() || is_archive() ) { add_filter( 'generate_show_comments', '__return_true' ); } } );
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
We’ll see what CSS is needed afterward.
January 3, 2023 at 1:19 am #2481556Ravi SaiveThe code is working fine, but it should display the below excerpt without background inline color on the homepage… Also, it should display only the date, not the last updated text. The comments count not showing on the left side in the homepage…
January 3, 2023 at 1:27 am #2481564Fernando Customer SupportCan you re-add the code so we can see it live and assess what to do next? If you have a staging site, you can add it there first, and we can go from there.
January 3, 2023 at 1:37 am #2481572Ravi SaiveI have added the code to the live site…
January 3, 2023 at 1:50 am #2481582Fernando Customer SupportI updated the code above. Can you update yours?
We’ll proceed with the CSS once we get the comment count to show.
Don’t worry about the “updated date”, we can fix that with CSS as well.
January 3, 2023 at 1:59 am #2481588Ravi SaiveI have updated the code, but still showing above the excerpt, it should show below with the separator hr tagline…
January 3, 2023 at 4:44 am #2481856Ravi SaiveWaiting for your update..
January 3, 2023 at 5:54 am #2481984DavidStaffCustomer SupportHi there,
change:
add_filter('generate_header_entry_meta_items', function($output){ if(is_home() || is_archive() ){ return array( 'author', 'date', 'comments-link' ); } return $output; }, 10);
To:
add_filter('generate_footer_entry_meta_items', function($output){ if(is_home() || is_archive() ){ return array( 'author', 'date', 'comments-link' ); } return $output; }, 10);
January 3, 2023 at 7:13 am #2482082Ravi SaiveThe given code shows meta tags twice see attached screenshot link.
January 3, 2023 at 9:19 am #2482415DavidStaffCustomer SupportGo to the Customizer > Layout > Blog, and on the archive tab, uncheck the post meta options for date and author. This will remove the top line.
January 3, 2023 at 9:27 am #2482431Ravi SaiveI tried that, but when I uncheck nothing showed, but when I check back it shows twice…
January 3, 2023 at 5:04 pm #2482860Fernando Customer SupportTo clarify, is this the only code you have now for this?:
add_filter('generate_footer_entry_meta_items', function($output){ if(is_home() || is_archive() ){ return array( 'author', 'date', 'comments-link' ); } return $output; }, 10);
Can you also take a screenshot of your current Archive settings in Customizer > Layout > Blog?
-
AuthorPosts
- You must be logged in to reply to this topic.