WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] post “excerpt” not displaying for popular posts

[Resolved] post “excerpt” not displaying for popular posts

  • My theme displays popular posts on the front page. Right now I can only see post titles and thumbnails. I found this in the functions.php, showing the layout that should appear but the excerpt is not showing up. Anyone know what I can do to fix it…I’m guessing it might be an easy fix. Thank you to anyone that can help!!

    # Displays a list of popular posts
    function fs_popular_posts($num, $pre='<li>', $suf='</li>', $excerpt=true) {
    	global $wpdb, $post;
    	$querystr = "SELECT $wpdb->posts.post_title, $wpdb->posts.comment_count, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT $num";
    	$myposts = $wpdb->get_results($querystr, OBJECT);
    	foreach($myposts as $post) {
    		echo $pre;
    		?>
    		<?php if (fs_settings('popular_thumb')=='enabled') : ?>
    		<?php fs_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?>
    		<?php endif; ?>
    		<a href="<?php echo get_permalink($post->ID); ?>"><?php the_title(); ?></a>
    		<p><?php echo fs_clean($post->post_excerpt, 177); ?></p>
    		<?php
    		echo $suf;
    	}
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] post “excerpt” not displaying for popular posts’ is closed to new replies.