• Resolved almer1984

    (@almer1984)


    Hello,

    I have 3 custom post types: dutch / belgium / germany. All posts in the 3 different post types can be rated. Now i want to show the following:
    – Top 5 rated posts where custom_post_type is dutch
    – Top 5 rated posts where custom_post_type is belgium
    – Top 5 rated posts where custom_post_type is germany

    How can i do this?

    Kind regards,
    Almer

    https://ww.wp.xz.cn/plugins/wp-postratings/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lester Chan

    (@gamerz)

    Here is an example:
    To get custom post type dutch (note the post_type)
    Example:

    <?php
    $dutch_query = new WP_Query( array( 'post_type' => 'dutch', 'meta_key' => 'ratings_average', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) );
    ?>
    <?php if( $dutch_query->have_posts() ) : ?>
        <?php while ( $dutch_query->have_posts() ) : $dutch_query->the_post(); ?>
            <?php the_title(); ?>
        <?php endwhile; ?>
    <?php endif; ?>

    For further read, checkout http://codex.ww.wp.xz.cn/Class_Reference/WP_Query.

    The rest you have to figure it out yourself.

    Thread Starter almer1984

    (@almer1984)

    Thanks a lot lester!

    Wow. This is awesome!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Rate custom post types’ is closed to new replies.