[resolved] Need post ordered by Views (2 posts)

  1. monu181
    Posted 2 years ago #

    I am using Custom Post Types(CPT), by using wp-types plugin. I want to have posts in my CPT listing ordered by the number of views.
    As wp-types uses Custom fields and WP-PostViews uses database to store the number of views of a post. How do i order the posts of CPT created by wp-types using WP-PostViews


  2. Lester Chan
    Plugin Author

    Posted 2 years ago #

    Sorry I am not too sure how that plugin works, but if you have access to query_posts(), you can do the following:

    <?php query_posts( array( 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>

    It will work with WordPress custom post type, just not too sure whether it will work with WP-Types plugin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic