Add Classes or Id's to Related Author Posts Code
-
I am trying to understand how to add a class to php so I can then style it with css.
Here is the code I am working on. I would like to style the post name and the thumb.
Thanks for any help as usual…
function get_related_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) ); $output = '<ul>'; foreach ( $authors_posts as $authors_post ) { $output .= get_the_post_thumbnail($authors_post->ID); $output .= '<li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li>'; } $output .= '</ul>'; return $output; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Add Classes or Id's to Related Author Posts Code’ is closed to new replies.