• Resolved yordanandreev

    (@yordanandreev)


    Hello,
    I want to install this plug-in on Twenty twenty theme. I cant find where to replace “get_the_author_posts_link()”.
    Help me please

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @yordanandreev ??

    The Twenty Twenty theme is using a slight different structure. To show the co-authors you can use the following code snippet:

    add_filter( 'twentytwenty_post_meta_location_single_top', 'remove_author' );
    function remove_author( $post_meta ) {
      if ( function_exists( 'coauthors_posts_links' ) ) {
        unset( $post_meta[0] );
      }
      return $post_meta;
    }
    
    add_action( 'twentytwenty_start_of_post_meta_list', 'add_co_authors', 10, 3 );
    function add_co_authors( $post_id, $post_meta, $location ) {
      if ( function_exists( 'coauthors_posts_links' ) ) {
        ?>
        <li class="post-author meta-wrapper">
          <span class="meta-icon">
            <span class="screen-reader-text"><?php _e( 'Post author', 'twentytwenty' ); ?></span>
            <?php twentytwenty_the_theme_svg( 'user' ); ?>
          </span>
          <span class="meta-text">
            <?php
            printf(
              /* translators: %s: Author name. */
              __( 'By %s', 'twentytwenty' ),
              coauthors_posts_links( null, null, null, null, false )
            );
            ?>
          </span>
        </li>
        <?php
      }
    }

    Hello @nielslange

    Your code output le correct “By Guest Author Name” (coauthors_posts_links) but Followed with “By WordPress Author” unwanted mention (author_posts_links)…

    Problem come from cutomizer: you have to disable the option to display Post Author for blog/posts…

    Is this a bug ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Co-Authors Twenty twenty theme’ is closed to new replies.