WordPress.org

Ready to get started?Download WordPress

Forums

Hide Author for some posts!? (4 posts)

  1. toto
    Member
    Posted 9 years ago #

    Hi to all best members.

    I want to excloude the author tag from all posts only in one of my categories.

    In my single.php i use the [<?php the_author(); ?>] tag.
    It show the author tag in post of all of my categories.

    Its good, but i have one of these categories that not need to show the author.

    How can I hide or exclude or add this tag only from posts in one categories.

    Is there a plugin that make a button in my #quicktags caled "post author" for example !???

    Or can I assign ivisible author or assign author for a special posts...

  2. Minna
    Member
    Posted 9 years ago #

    You could put the_author inside this code bit:
    <?php $post = $wp_query->post; if ( !in_category('1') ) { ?>
    <?php the_author(); ?>
    <?php } ?>

    Then it'll show the author's name if NOT in category so-and-so (change the number 1 to the correct category ID)
    I tested it out on my blog so it should work

    Edit Actually just
    <?php if ( !in_category('1') ) { ?>
    <?php the_author(); ?>
    <?php } ?>

    works fine too

  3. toto
    Member
    Posted 9 years ago #

    some ideas:

    for exaple if the author is "admin" the system dont display the author tag.

    or to have a checkbox in write a post section caled sohw hide author!??

    some help

  4. toto
    Member
    Posted 9 years ago #

    Thank you very much Minna its works very good.

    Good bless you :)

Topic Closed

This topic has been closed to new replies.

About this Topic