Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing a group blog on wordpress (first time working with it) and the client has requested that a 'None' option be added where an item can be posted without a "by" attribution. So basically there would be one article / excerpt template for attributed author's posts and another for the none option where the byline would just be the date posted without the "by [author name]." Is this possible with wordpress?

Thanks!

share|improve this question

migrated from stackoverflow.com Jun 23 '11 at 6:58

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

It's possible to do, but would take hacking up the theme. One convention I've seen is to create a user with a generic name, like Guest, or the name of your site.

If you would still like to hack away. Then put a condition around the line\s in the template that displays the author like so:

<?php if (get_the_author() != 'none') : ?> 
    <?php the_author(); ?>
<?php endif; ?>

or alternately, the shorthand...

<?php echo (get_the_author() != 'none') ? get_the_author() : ''; ?>

Then you define an author named 'none'.

The post will only display the author's name if the name isn't 'none'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.