Title: Display elements depending on post author
Last modified: August 20, 2016

---

# Display elements depending on post author

 *  [todorbb](https://wordpress.org/support/users/todorbb/)
 * (@todorbb)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/display-elements-depending-on-post-author/)
 * Hello,
    I am pretty new to php and I am not able to solve this for my blog. I
   would like to display content in the sidebar depending on the post author.
 * For example if the post author is XXXX I would like to display banner YYY in 
   the sidebar.
 * I know how to display banners and how to write an IF statement but I am wondering
   about the pos_author- should I use “the_author” or “get_the_author”.
 * Could somebody help me?

Viewing 1 replies (of 1 total)

 *  [bythegram](https://wordpress.org/support/users/bythegram/)
 * (@bythegram)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/display-elements-depending-on-post-author/#post-3086939)
 * Keep in mind both “the_author” and “get_the_author” need to be used within [the loop](http://codex.wordpress.org/Template_Tags/get_the_author)
   so depending on how you are displaying your banners this might be tricky. With
   that said you’d want to use “get_the_author” because it will allow you to pass
   it to a php variable then write the appropriate if statement.
 * If you post your code in [pastebin](http://pastebin.com/) it may be more useful
   for anyone trying to help.

Viewing 1 replies (of 1 total)

The topic ‘Display elements depending on post author’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [bythegram](https://wordpress.org/support/users/bythegram/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/display-elements-depending-on-post-author/#post-3086939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
