WordPress.org

Ready to get started?Download WordPress

Forums

Easy Popular Posts
From specific category (2 posts)

  1. syru
    Member
    Posted 3 years ago #

    Is there a way to show popular posts from specific category?

    Thank you

  2. zudie
    Member
    Posted 3 years ago #

    Yes, modify the query in the plugin code:

    global $wpdb;
    $posts = $wpdb->get_results("
    SELECT comment_count, ID, post_title
    FROM $wpdb->posts wposts
    LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
    LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    WHERE $wpdb->term_taxonomy.taxonomy = 'category'
    AND $wpdb->term_taxonomy.term_id IN($my_category_id)
    AND post_type='post' AND post_status = 'publish' AND comment_count >= " . $ns_options['comments']."
    		" . $sqlorder . " LIMIT 0 , " . $ns_options['count']
    	);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic