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.
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?
try it with something like this in single.php:
if($posts[0]->post_author == 1){ // author ID
// do stuff
}
@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?
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; ?>
Works absolutely perfect! Thx so much for that keesie!
You’re welcome. Glad you got it resolved.