WordPress.org

Ready to get started?Download WordPress

Forums

Some PHP help for Co-Authors Plugin (2 posts)

  1. dpetty
    Member
    Posted 6 years ago #

    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!

  2. dpetty
    Member
    Posted 6 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags