WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] Sort custom post type by rating score (2 posts)

  1. darlinncordova
    Member
    Posted 4 weeks ago #

    hi i did this code and works fine but i cant get all "juegos posts" just posts with rating , how can i get rating and no rating list posts.

    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $args = array(
    	'post_type' => 'juegos',
    	'post_parent' => 0,
    	'meta_key' => 'ratings_average',
    	'orderby'=>'meta_value_num',
    	'order'=>'DESC',
    	'paged'=> $paged,
    	'posts_per_page' => 5
    );
    $the_query = new WP_Query( $args );

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum's parser.]

    https://wordpress.org/plugins/wp-postratings/

  2. Lester Chan
    Member
    Plugin Author

    Posted 4 weeks ago #

    Sorry, you can't get posts without ratings, there is a limitation with the WP_Query and custom post field.

    The only manual way I can think of is manually create the custom post field "ratings_average" for post that have no ratings.

    The reason why it does not have those fields I am guessing is because it was created before WP-PostRatings was activated. Once WP-PostRatings is activated, upon every post, it will create the custom post field with 0 as the value.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.