Solved

Wordpress: adjust  get_the_author() function?

Posted on 2013-06-22
3
461 Views
Last Modified: 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.

Ideas?

Thanks,

Chris
0
Comment
Question by:St_Aug_Beach_Bum
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
Comment Utility
0
 

Author Closing Comment

by:St_Aug_Beach_Bum
Comment Utility
Oh, well darn, your right :)

When I googled it earlier today, I didn't find squat!

Thank you very much - these will work!

Chris
0
 
LVL 70

Expert Comment

by:Jason C. Levine
Comment Utility
Heh, no worries.  

Try "Wordpress guest authors" as your terms...
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
This article discusses how to create an extensible mechanism for linked drop downs.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now