I have shortcode that generates a list of posts, however the posts are automatically wrapped in <pre>
tags and I am unsure how to remove them. Example:
<pre><li><a href=''><img src=''></a></li></li><pre>
This is the shortcode:
[loop the_query="tag=news"]
This is the function:
function custom_query_shortcode($atts) {
extract(shortcode_atts(array(
"the_query" => ''
), $atts));
$the_query = preg_replace('~�*([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $the_query);
$the_query = preg_replace('~�*([0-9]+);~e', 'chr(\1)', $the_query);
query_posts($the_query);
$output = '';
$temp_title = '';
$temp_link = '';
$temp_thumb = '';
if (have_posts()) : while (have_posts()) : the_post();
$temp_title = get_the_title($post->ID);
$temp_link = get_permalink($post->ID);
$temp_thumb = the_post_thumbnail( 'side-thumb' );
$output .= "<li><a href='$temp_link'>$temp_title <img src='$temp_thumb'></a></li>";
endwhile; else:
$output .= "nothing found.";
endif;
wp_reset_query();
return $output;
}
add_shortcode("loop", "custom_query_shortcode");
I would have a look at the following :
Good luck.