WordPress.org

Ready to get started?Download WordPress

Forums

Turn off author name (11 posts)

  1. ranjeet
    Member
    Posted 8 years ago #

    Is there a way to selectively turn off the "posted by author" text on a specific post or page?

  2. hooopla
    Member
    Posted 8 years ago #

    Sure. In you're seeing author info right now, then in your index.php template you'll probably see a line like this:

    <small><?php the_time('F jS, Y') ?> by <?php the_author() ?></small>

    If you want to remove the author info, just edit that part of the line so that it reads:

    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    The "<!--" and "-->" are comment symbols that take the enclosed bit of code out of play. Alternatively, you could just erase that bit so that it looks like:

    <small><?php the_time('F jS, Y') ?></small>

  3. Lorelle
    Member
    Posted 8 years ago #

    No, there is no "selective" way to remove the author information. If you remove it for one, you remove it for all, I believe.

  4. ranjeet
    Member
    Posted 8 years ago #

    I don't want to remove the "posted by author" comment on every post, just on a select few. Is that possible? Thanks.

  5. Beel
    Member
    Posted 8 years ago #

    Only if you can find some common element between the posts you want to remove it from that is distinctive from those you don't. As in, "all posts in 'anonymous' category."

    I suppose you could use David Chait's QuickPHP and insert the author within the post itself.

  6. jalenack
    Member
    Posted 8 years ago #

    This is possible .. It can easily be done by hacking the core or you could create a plugin that hijacks the_author() and only outputs for certain people. I've got an example of this as a plugin at http://code.jalenack.com , except for comment names instead of author names. If you can't take it from there or don't know much about php, post back and I could mockup a plugin.

  7. Beel
    Member
    Posted 8 years ago #

    Right, "some common element between posts..." will allow you do to what you want. In jalenack's case it is by author. What specifically do you want to select on?

  8. ranjeet
    Member
    Posted 8 years ago #

    First off, thanks for all the replies!

    I'm trying to make it so that on "pages" there is no author byline while on "posts" there are. How would I go about doing this?

    Regarding jalenack's post, unfortunately I'm still kind of new at WordPress and don't have the requiste php knowledge to make a plugin.

  9. Lorelle
    Member
    Posted 8 years ago #

    Use the example from Pages http://codex.wordpress.org/Pages on how to make a custom template file and in that template file, remove the author tag as described above.

    Make sure you choose that template in your Manage >Pages specific Pages where you want to do this, and you are done.

  10. Kafkaesqui

    Posted 8 years ago #

    Uh, I think using a page.php would be easiest.

    Make a copy of the single.php (if your theme does not have one, use index.php), name it page.php (or, you may already have one), and edit out the_author() from that. WordPress will use page.php for Pages automatically.

  11. RichH
    Member
    Posted 8 years ago #

    I do that. Just create a user with no first or last name. I have a user nicknamed "anon" who gets all the pages or posts that I want to appear with no byline.

    Then pick that user to be author.

    You want to be sure that the_author() in your templates won't show a nickname. I do that in my templates by showing the byline as: the_author_posts_link('namefl')

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags