Simple shortcode turning overcomplicated
<?php
function recent_posts() {
$q = new WP_Query(
array( 'orderby' => 'date', 'posts_per_page' => '1')
);
$list = '<ul>';
while($q->have_posts()) : $q->the_post();
//$location = bloginfo('template_directory');
$imgsrc = get_post_meta($q->ID, 'blog-left-image', true);
$list .= '<li><a href="' . get_permalink() . '">' . get_the_title();
$list .= '<img src="' . $location . '/image.php/resized.jpg?width=80&height=80&image=' . $imgsrc . '" alt="" class="related-posts-img" style="float:left; margin-right:5px;" />';
$list .= '</a></li>';
endwhile;
wp_reset_query();
return $list . '</ul>';
add_shortcode("recent_posts", "recent_posts");?>
Thought this would be straightforward. Want to create a shortcode to display the post thumbnails. Problem is, the get_post_meta(...) outputs nothing and the bloginfo('template_directory') doesn't concatenate correctly.