Site logo

Archived topic

Change URL Author Link

4 replies · Started by Alessandro on October 9, 2020

Viewing posts 1–5 of 5

Hi i just want to change the author url showed in post page.

and I followed these instructions:
https://docs.generatepress.com/article/generate_post_author_output/

insert this code in the function.php:

add_filter( 'generate_post_author_output', function( $output ) {    
    return '<a href="MY CUSTOM URL">My Name</a>';
} );

In the theme it is invoked in Elements > Post Hero:
{{post_author}}

Why don't work?
Thank you

Hi,
have mod but don't work:


add_filter( 'generate_page_hero_post_author', function() {
    global $post;
    $author_id = $post->post_author;

    return sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author"><a class="url fn n" href="https://www.nomesito.it/author/alessandro/" title="Scopri chi sono" rel="author" itemprop="url"><span class="author-name" itemprop="name">Alessandro</span></a></span>',
        esc_html( get_the_author_meta( 'display_name', $author_id ) )
    );
} );

Excuse me :)
I solved:

add_filter( 'generate_page_hero_post_author', function( $output ) {    
    return '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author"><a class="url fn n" href="myurl" title="Scopri chi sono" rel="author" itemprop="url"><span class="author-name" itemprop="name">Alessandro</span></a></span>';
} );

Glad to hear :)

This archived topic is closed to new replies.