[Resolved] How To change link to Author page

Home Forums Support [Resolved] How To change link to Author page

Home Forums Support How To change link to Author page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1106312
    Jodie

    Hi guys

    Iโ€™ve just checked the link that the author name directs to and it seems to be an archive page โ€“

    I want this link to direct to the About Page.

    How can I do that please?

    Cheers

    Jodie

    #1106325
    Leo
    Staff
    Customer Support

    Hi there,

    Do you only have one author in your blog?

    Let me know ๐Ÿ™‚

    #1106334
    Jodie

    Yes it is just me at this stage ๐Ÿ™‚

    #1106347
    Leo
    Staff
    Customer Support

    Try this PHP snippet:

    add_filter( 'generate_post_author_output', function() {
        printf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="byline">%1$s<span class="author vcard" %5$s><a class="url fn n" href="https://LINK-TO-ABOUT-PAGE" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span></span> ',
    					apply_filters( 'generate_inside_post_meta_item_output', '', 'author' ),
    					esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    					/* translators: 1: Author name */
    					esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
    					esc_html( get_the_author() ),
    					generate_get_microdata( 'post-author' )
            ) 
        );
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Make sure to replace LINK-TO-ABOUT-PAGE with the actual link.

    #1106365
    Jodie

    Thanks very much Leo.

    I will try to do as you have suggested and get back to you.

    #1106368
    Jodie

    Hi Leo

    It is coming back with this error message for this line
    generate_get_microdata( ‘post-author’ )

    Your PHP code changes were rolled back due to an error on line 35 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.

    syntax error, unexpected end of file, expecting ‘,’ or ‘)’

    What shall I do?

    #1106379
    Leo
    Staff
    Customer Support

    That’s weird. I tested the code without any issues:
    https://www.screencast.com/t/MrdcweIEmazk

    What happens if you remove your other functions?

    #1106385
    Jodie

    Thank you Leo

    I was missing some of the code I realise now.

    What happens to that author page that the link was originally linking to?

    Where is that now?

    Cheers

    Jodie

    #1106389
    Jodie

    Can I ask you this Leo?

    With the Publish Date it hyperlinks back to the post you are on.

    Why is the date linked, what is the purpose of that?

    Cheers

    Jodie

    #1106906
    David
    Staff
    Customer Support

    Hi there,

    Author pages are generated by a function so the Old Author Page doesn’t really exist unless the function for it is called.

    Links on post meta such as the date is just the norm for WordPress.

    #1107334
    Jodie

    Thanks very much David.

    So due to the author pages generated by a function, I am assuming that Google doesn’t index that page. Is that right?

    Is there a way to remove the link from the date?

    Thanks as always for your continued support.

    Cheers

    Jodie

    #1107360
    Leo
    Staff
    Customer Support

    I believe so. Author archive isn’t very important from my understanding.

    Try this snippet for date link:
    https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date

    #1108108
    Jodie

    Thanks very much Leo

    That snippet worked.

    Cheers

    #1108116
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

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