Support » Plugin: Co-Authors Plus » Styling the delimiters separately from coauthors() array?

  • I’m using the simple coauthors(); template tag (creates an array, no links, standard delimiter setup of commas between authors, with ‘and’ before last author.) I’d like the authors to be bold, and the delimiters to retain the original lighter weight.

    Something like:
    Written By: Author01, Author02 and Author3

    For now I’ve inserted span classes around coauthors__echo function to give me control over the styles of the delimiters’ font treatment.
    i.e:

    ...
    $default_between_last = ( defined( 'COAUTHORS_DEFAULT_BETWEEN_LAST' ) ) ? COAUTHORS_DEFAULT_BETWEEN_LAST :  __( '<span class="array-delimiter"> and </span>', 'co-authors-plus' );

    Is there a more elegant solution to achieve this? I notice other template tags with $args that wrap authors in anchors with classes applied, but I’ve been unable to alter the actual coauthors(); function to inject html spans around the authors (which would obviously be a better solution for controlling a wrapper and styling the author instead of relying on these span inserts between them!)

    Does anyone have a similar implementation and care to share some guidance?

    Thanks!

    • This topic was modified 2 years, 4 months ago by  down4keeps.
Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve been able to do styling in the past without modifying code. Can you share a link to where I could see your Co-Authors + in action?

    • This reply was modified 2 years, 3 months ago by  .

    In the past, I’ve used coauthors_posts_links() to wrap the links for styling. I’ve used this usually in a function.

    It has 4 options: between, betweenLast, before and after.

    In the past, I’ve done stuff like:
    coauthors_posts_links(',', ' and ', '<div class="all-the-authors">', '</div>);

    Something like that would get all the authors and print them like …

    <div class="all-the-authors"><a href="authorURL">Author One</a>, <a href="authorURL">Author Two</a>, <a href="authorURL">Author Three</a> and <a href="authorURL">Author Last</a></div>

    Hopefully that helps!

    • This reply was modified 2 years, 3 months ago by  jlschillinger.
    • This reply was modified 2 years, 3 months ago by  jlschillinger.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Styling the delimiters separately from coauthors() array?’ is closed to new replies.