• I want to create some kind of conditional if statement such that, If the author of a post is “admin” (ID #1), do nothing. Otherwise, display the author’s name. In other words, if the post’s author is set to “admin,” then nothing would be displayed in the byline area. Is this even possible?

    Perhaps conditional tags doesn’t allow this? Might I have to create a specific tag to identify these posts or something… and use that with conditional tags instead?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Easy.

    $auth = get_the_author();
    if ($auth != 'admin') echo $auth;
    Thread Starter Dan Petty

    (@dpetty)

    Thanks, Otto. It worked great! I’m going to complicate things a bit. I want that author displayed to be a link to the author’s posts. I’m also using the “Co-Authors” plugin that allows me to add multiple authors to a post.

    To clarify: If the author is “admin” I want none of the information — displayed below — to appear on the page. Otherwise, it should appear.

    <div class="byline">
    By <?php if(function_exists('coauthors_posts_links'))
          coauthors_posts_links();
    else
          the_author_posts_link(); ?>
    </div>
    <div class="bytitle">
          <?php echo c2c_get_custom('Bytitle'); ?>
    </div>
    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    <?php
    $auth = get_the_author();
    if ($auth != 'admin') :
    ?>
    // all your display stuff here
    <?php endif; ?>

    Just like that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional Tag “No Display”’ is closed to new replies.