3 Fun Conditional Tricks for Your WordPress Custom Fields | WebReference | 2 | WebReference

3 Fun Conditional Tricks for Your WordPress Custom Fields | WebReference | 2


[prev]

WordPress Custom Field Trick #3: Conditionally Display Guest Authors' Names

If you have a blog where you invite guest authors to write for you and don't want to create accounts for them, you can create a custom field for the guest authors' name and display it in a case where this field has a value. Create a new custom field with the key Guest-Author. Enter your guest author's name as the value for it.

WordPress Custom Fields

Now open the file functions.php and enter the following code to create a new function.

WordPress Custom Fields

Now check out the output in your Web browser. The author name should contain the value you entered in the value for the key Guest-Author.

WordPress Custom Fields