Wordpress: adjust get_the_author() function?
Posted on 2013-06-22
I have guest authors sometimes.
I don't want to set them up as members of my blog. But I would like to display their name as being the author of the post they write.
I enter their name as a custom field (field name "guest_auth") when I save the post.
Then, because I need to set the 'author' setting to something, I set it to "guest".
Would it be possible to have a function in functions.php so that whenever get_the_author() is called in my theme (post pages, category pages, home page, etc).... IF there is a 'guest_auth' value, it will show that name instead of "guest"?
Or perhaps, if get_the_author() == "guest," it uses the guest_auth value for that post...
I realize I could do this in the code on each page/post, but there are a lot of pages in my theme. Seems it would be more efficient to do this in functions.php if there is a way.