- This topic has 5 replies, 2 voices, and was last updated 3 years, 12 months ago by
Tom.
-
AuthorPosts
-
March 26, 2019 at 10:10 am #850601
dassana
hi
from each post, i would like to link my name to the about page. currently i am using this code and it removes the linking of the author url. please let me know how i do i add about page url to my name on the post.
add_filter( 'generate_post_author_output','tu_no_author_link' ); function tu_no_author_link() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></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() ) ) ); 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>'; } }
GeneratePress 2.2.2GP Premium 1.7.8March 26, 2019 at 3:50 pm #850848Tom
Lead DeveloperLead DeveloperHi there,
Try this:
add_filter( 'generate_post_author_output','tu_no_author_link' ); function tu_no_author_link() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a href="%5$s"><span class="fn n 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() ), 'URL TO YOUR ABOUT PAGE HERE' ) ); 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>'; } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 27, 2019 at 4:16 am #851185dassana
thank you tom. the code worked very well. if i have to add a no follow tag to the about page link, then what should i modify in the code. thanks again.
March 27, 2019 at 8:29 am #851571Tom
Lead DeveloperLead DeveloperIn the code, find this:
<a href="%5$s">
And replace it with:
<a href="%5$s" rel="nofollow">
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 28, 2019 at 2:57 am #852219dassana
thank you tom. the code worked. thanks again.
March 28, 2019 at 8:40 am #852628Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.