Display author nickname
-
I’m trying to get the author nickname to display but it’s not working and I’m obviously doing something wrong!
Here is what I have: (nothing displays and there is something in the nickname field)<?php $rand_posts = get_posts('numberposts=5&orderby=post_date&order=DESC&cat=16'); foreach( $rand_posts as $post ) : echo '<div class="twelve columns blog">'; $selected_id = get_the_ID(); $queried_post = get_post($selected_id); $selected_content = $queried_post->post_content; $selected_name = get_the_title($selected_id); $selected_excerpt = wp_trim_words($queried_post->post_content,$num_words = 50, $more = null); $selected_link = get_permalink($selected_id); $selected_pic = get_the_post_thumbnail($selected_id, 'rsm-medium'); $selected_author = get_the_author_meta('nickname'); $selected_date = $queried_post->post_date; $newDate = date("F j, Y", strtotime($selected_date)); echo '<h2 style="font-size:34px;font-weight:200;"><a href="'.$selected_link.'" >' . $selected_name . '</a></h2>'; echo $selected_pic; echo '<div class="blog-author-date">Posted by' . $selected_author; echo $newDate . '</div>'; echo $selected_excerpt; echo '</div> <!-- / twelve -->'; endforeach; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display author nickname’ is closed to new replies.