WordPress.org

Support

Support » How-To and Troubleshooting » Some PHP help for Co-Authors Plugin

Some PHP help for Co-Authors Plugin

  • I’m a newspaper reporter with limited coding experience. I’m designing a newspaper Web site using WordPress — and I need some coding help. I’m using the the “Co-Authors” plugin. A little background: At our paper, we have two “bytitles” for reporters: either they’re “Collegian Reporter” or “Collegian Staff.” That designation is defined in the “nickname” section of their user profile. But when a story has multiple authors I want the bytitle to be “Collegian Reporters.” So, this is what I coded:

    <div class=”byline”>
    <?php if(function_exists(‘coauthors_posts_links’))
    coauthors_posts_links();
    else
    the_author_posts_link(); ?>
    </div>

    <span class=”bytitle”>
    <?php if(function_exists(‘coauthors’))
    echo ‘Collegian Reporters’;
    else
    echo ‘the_author_nickname();’ ?>
    </span>

    The “byline” code either posts the author’s name or names if there are multiple authors as links to their previous stories. In the bytitle part, I essentially want to say: “If there are multiple authors for the post, make the bytitle say ‘Collegian reporters.’ Otherwise (if there’s a single author), use the single author’s nickname.”

    Can anyone help?

    Thanks!

Viewing 1 replies (of 1 total)
  • By the way, the code as written causes any author who has been part of a multiple author post to have the designation “Collegian Reporters,” even if it’s a single author. So, I’ve been a part of multiple author posts, but my title on other stories just by me is now “Collegian Reporters.”

    Just to clarify…

Viewing 1 replies (of 1 total)
  • The topic ‘Some PHP help for Co-Authors Plugin’ is closed to new replies.