WordPress.org

Ready to get started?Download WordPress

Forums

how to exclude author name in admin posts (2 posts)

  1. yashmistrey
    Member
    Posted 3 years ago #

    could it possible to hide / exclude author (admin) name in posts ?

    only post written by admin not authors

    i tried but it's not work
    <?php the_author_posts_link($exclude_admin); ?>

  2. chavo
    Member
    Posted 3 years ago #

    You can do something like this:

    <?php $getid = $posts[0]->post_author; if($getid == 1){ ?>
    /* DISPLAY ADMIN NAME BUT NOT LINK TO AUTHOR PAGE */
    Published by <?php the_author(); ?>
    		<?php } else { ?>
            Published by <?php the_author_posts_link(); ?>
            <?php } ?>

    Or, if you don't want to display name

    <?php $getid = $posts[0]->post_author; if($getid == 1){ ?>
    		<?php } else { ?>
            Published by <?php the_author_posts_link(); ?>
            <?php } ?>

    Note id == 1 its default admin ID.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags