• Resolved tayfuntatar

    (@tayfuntatar)


    In my website, some articles have multiple authors. However, due to the settings of the theme we are using, it is possible to include several authors only by seperating them with “and”. I was wondering if it is possible to change the word “and” in between author names with a comma.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • This string is defined in file template-tags.php (line 154). It should also be translated with the language files but this string’s translation does not work (at least in French), surprisingly. So what you can do is modify this line, i.e. replace ‘ and ‘ by ‘, ‘ and save + upload this file. It will work as you wish until a new version of the plugin overwrites your edit. Then you’ll have to do it again.

    https://www.ads-software.com/support/topic/option-for-with-instead-of-and/

    Maybe someone will be able to debug this issue which as not been fixed yet…

    Hello @tayfuntatar & @amicalmant ??

    By default, the co-authors should be separated with , and the second-last and last co-authors are separated with and. I assume that you have added the template tags to your themes as described on https://docs.wpvip.com/technical-references/plugins/incorporate-co-authors-plus-template-tags-into-your-theme/. The separates can be adjusted in the function call coauthors_posts_links().

    The example on https://docs.wpvip.com/technical-references/plugins/incorporate-co-authors-plus-template-tags-into-your-theme/ shows the function call

    coauthors_posts_links( null, null, null, null, false ).

    The definition of this function is as follows:

    /**
     * Outputs the co-authors display names, with links to their posts.
     * Co-Authors Plus equivalent of the_author_posts_link() template tag.
     *
     * @param string $between Delimiter that should appear between the co-authors
     * @param string $betweenLast Delimiter that should appear between the last two co-authors
     * @param string $before What should appear before the presentation of co-authors
     * @param string $after What should appear after the presentation of co-authors
     * @param bool $echo Whether the co-authors should be echoed or returned. Defaults to true.
     */
    function coauthors_posts_links( $between = null, $betweenLast = null, $before = null, $after = null, $echo = true ){
      return coauthors__echo('coauthors_posts_links_single', 'callback', array(
        'between'     => $between,
        'betweenLast' => $betweenLast,
        'before'      => $before,
        'after'       => $after
      ), null, $echo );
    }

    When using the plugin with the Twenty Twenty-One theme without any adjustments, this is what I see on my end:


    Link to image: https://d.pr/i/48Uooe

    Changing the function call from
    coauthors_posts_links( null, null, null, null, false )
    to
    coauthors_posts_links( ' | ', ' | ', null, null, false )
    results in:


    Link to image: https://d.pr/i/eZAvxQ

    If you’re seeing and or & as separator, something must be overwriting this default functionality. I suggest deactivating all other plugins to test this plugin isolated. Alternatively, I suggest adjusting the function parameter as I explained above. I hope this helps to display the co-authors in the desired way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Seperating Multiple Writers with Comma’ is closed to new replies.