- This topic has 55 replies, 4 voices, and was last updated 6 years, 1 month ago by
Tom.
-
AuthorPosts
-
July 29, 2019 at 10:18 pm #970709
Ravi Dixit
I don’t know why It is showing Leave a Comment there… I am not using anything else except these codes I shared with you.
It is only showing with the post which has no comments.
July 30, 2019 at 8:47 am #971225Tom
Lead DeveloperLead DeveloperAny chance you can send me temporary admin login details so I can take a closer look?: https://generatepress.com/contact
July 30, 2019 at 9:16 am #971264Ravi Dixit
I sent you temporary admin account’s login details.
July 30, 2019 at 9:28 am #971289Tom
Lead DeveloperLead DeveloperThat link is coming from this Code Snippet: Meta Style Customization
You can find it in the “Snippets” area of your Dashboard.
July 30, 2019 at 2:43 pm #971546Ravi Dixit
Okay so now what to do?
July 30, 2019 at 4:47 pm #971649Tom
Lead DeveloperLead DeveloperIf you disable that Snippet, the Leave a comment text should go away.
July 30, 2019 at 6:55 pm #971703Ravi Dixit
After removing that snippet, Author gravatar and name is not showing on a single post and also in the search result.
July 31, 2019 at 9:05 am #972305Tom
Lead DeveloperLead DeveloperOk, so we need that snippet, but we need to tweak the PHP.
Can you share the PHP from the snippet in here? Then I’ll tweak it and you can replace it.
July 31, 2019 at 9:22 am #972327Ravi Dixit
Here it is:
add_filter( 'generate_post_author', '__return_false' ); add_filter( 'generate_show_comments', '__return_false' ); add_filter( 'generate_post_date_output', 'tu_fancy_byline' ); function tu_fancy_byline( $date ) { printf( ' <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' ) ) ) ); if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo '</span>'; } echo $date; }
July 31, 2019 at 9:22 am #972329Tom
Lead DeveloperLead DeveloperTry this instead:
add_filter( 'generate_post_author', '__return_false' ); add_filter( 'generate_show_comments', '__return_false' ); add_filter( 'generate_post_date_output', 'tu_fancy_byline' ); function tu_fancy_byline( $date ) { printf( ' <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' ) ) ) ); echo $date; }
July 31, 2019 at 5:23 pm #972604Ravi Dixit
Hey, Tom!
It is working but the author name and gravatar is at the end, See this image https://prntscr.com/omqftj
And space should be the same as like between first two meta.
One more thing, How Can I align all meta in one single line on mobile view as I did in single posts.
August 1, 2019 at 9:13 am #973183Tom
Lead DeveloperLead DeveloperTry adding this:
add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'date' ); } );
August 1, 2019 at 8:41 pm #973550Ravi Dixit
Hi tom
I have added the above code but still no change…
August 2, 2019 at 8:09 am #974043Tom
Lead DeveloperLead DeveloperInstead of the function you’re using right now to add the gravatar, try this:
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' ) ) ) ); } );
August 2, 2019 at 9:13 am #974113Ravi Dixit
It is working the same as the previous code I was using.
Here you can see: https://prnt.sc/onjsge
I want to move Author image and name at the first, and same space between all meta.
-
AuthorPosts
- You must be logged in to reply to this topic.