WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. monu181
    Member
    Posted 9 months 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

    http://wordpress.org/plugins/wp-postviews/

  2. Lester Chan
    Member
    Plugin Author

    Posted 9 months 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

Reply

You must log in to post.

About this Plugin

About this Topic