Title: Custom Single.php for specific author
Last modified: August 20, 2016

---

# Custom Single.php for specific author

 *  [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/)
 * What’s the best way to create different single.php’s for specific authors. I 
   saw a [tutorial](http://elliotjaystocks.com/blog/tutorial-multiple-singlephp-templates-in-wordpress/)
   that was written a while ago that was for categories but I’m wondering if there’s
   a new way to do it for authors.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380808)
 * The WordPress Template Hierarchy does not include a `single-$author.php` template.
 * You could create a custom _archive index page_ for a given author, using `author-
   $nicename.php` or `author-$id.php` template files, but to create a custom _single
   post_ on a per-author basis, you’ll need to get your hands a bit dirty with filtering`
   body_class()` and/or `post_class()` in order to add an author-specific CSS class
   to the HTML body tag and/or the post div.
 *  Thread Starter [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380828)
 * All I’m really trying to do is display a certain ad unit for a specific author
   with their posts. Is there an easier solution for that?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380831)
 * try it with something like this in single.php:
 *     ```
       if($posts[0]->post_author == 1){ // author ID
       // do stuff
       }
       ```
   
 *  Thread Starter [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380904)
 * [@keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Ok say I have an ad which is ‘<script>…</script>’.
 * How can use that code you gave to show three different scripts for 3 different
   authors inside a div?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380911)
 * Try it with this:
 *     ```
       <?php if($posts[0]->post_author == 1) : ?>
        <script></script> <!-- script for author ID 1 -->
        <?php elseif($posts[0]->post_author == 5) : ?>
        <script></script> <!-- script for author ID 5 -->
        <?php elseif($posts[0]->post_author == 8) : ?>
        <script></script> <!-- script for author ID 8 -->
        <?php endif; ?>
       ```
   
 *  Thread Starter [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380932)
 * Works absolutely perfect! Thx so much for that keesie!
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380933)
 * You’re welcome. Glad you got it resolved.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Custom Single.php for specific author’ is closed to new replies.

 * 7 replies
 * 3 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/custom-singlephp-for-specific-author/#post-2380933)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
