WordPress.org

Ready to get started?Download WordPress

Forums

WP Voting
Sorting Posts by Vote Count (4 posts)

  1. anjan.dev.phukan
    Member
    Posted 1 year ago #

    I am using the following code, to show the posts in vote count order.

    <?php
    /**
     * SORTS THE POSTS BY VOTE COUNT
     */
    add_filter('posts_orderby', 'edit_posts_orderby');
    add_filter('posts_join_paged','edit_posts_join_paged');
    
    function edit_posts_join_paged($join_paged_statement) {
        global $wpdb;
        $join_paged_statement = "LEFT JOIN ".$wpdb->prefix."wpv_voting ON ".$wpdb-       >prefix."wpv_voting.post_id = $wpdb->posts.ID";
        return $join_paged_statement;
    }
    
    function edit_posts_orderby($orderby_statement) {
        global $wpdb;
        $orderby_statement = "(".$wpdb->prefix."wpv_voting.vote_count) DESC";
        return $orderby_statement;
    }
    ?>

    It works fine for the listing page. But when I go to a category, it doesn't show any result.

    Please help.

    http://wordpress.org/extend/plugins/wp-voting/

  2. Waterhead
    Member
    Posted 1 year ago #

    I post here because similar topic :D.

    How to put vote down and up? and number what position post has? Like first post is number one etc.

  3. dreamgrowers
    Member
    Posted 1 year ago #

    I would also know how to get this to sort the category posts instead of breaking them.

  4. domdino
    Member
    Posted 1 year ago #

    Another vote for this!! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic