This code is a way to show a list popular posts without a plugin...
Code: Select all
<li><h3>Popular Posts</h3>
<ul class="bullets">
<?php
$popular_posts = $wpdb->get_results("SELECT id,post_title FROM {$wpdb->prefix}posts ORDER BY comment_count DESC LIMIT 0,10");
foreach($popular_posts as $post) {
print "<li><a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";
}
?>
</ul>
</li>Code: Select all
<div style="float:left; margin-right: 5px"><img src="<?php $key="fav"; echo get_post_meta($post->ID, $key, true); ?>" /></div>Code: Select all
<li><h3>Popular Posts</h3>
<ul class="bullets">
<?php
$popular_posts = $wpdb->get_results("SELECT id,post_title FROM {$wpdb->prefix}posts ORDER BY comment_count DESC LIMIT 0,10");
foreach($popular_posts as $post) {
print "<li><div style=\"float:left; margin-right: 5px\"><img src=\"<?php $key=\"fav\"; echo get_post_meta($post->ID, $key, true); ?>\" /></div><a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";
}
?>
</ul>
</li>I've tried and tried to no avail
with the camera next to the title just like i would if i had styled the <li> tags using css. When I do i do it this way
no image. The errors only show up when i try different ways of escaping it, more of a trial and error method which i know are probably incorrect, more like a shot in the dark. When i view source sometimes it looks like <li><img src="" sometimes its <li><img src"fav" sometimes it's <li><img src=" />" i can even get the correct path to show up, but not the image. I can usually get it right after a few tries but this time i'm stumped