Support » Fixing WordPress » post “excerpt” not displaying for popular posts

  • Resolved wildbug


    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>
    		echo $suf;
Viewing 4 replies - 1 through 4 (of 4 total)
  • Seems like I am using the wrong term for excerpts. The original code had “post_content” and I changed it.

    Strange, I can find “post_excerpt” as a term in the support forum but for some reason, it doesn’t work here. Post_content does work however. But I need to use the excerpt. Any ideas?

    Yay, I figured it out!! I had to change a term in the query string…

    And how did you solved?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘post “excerpt” not displaying for popular posts’ is closed to new replies.