Support » Fixing WordPress » How to call for posts to be ordered by meta key and meta value?

  • chea24

    (@chea24)


    Hey guys. I’m trying to create url links to sort posts.

    I have sort by DATE: category/whatever/?order=asc&orderby=date
    ABC: category/whatever//?order=asc&orderby=title

    Now I’m trying to order categories by meta-key and meta value.
    I have implemented code in my header to count the number of views for each post.
    If I could order posts in a category by meta key and meta value I would be able to order posts in a category by most viewed.

    I can do this already if i create a page template for each category using this:

    $wp_query->query(‘meta_key=popular&orderby=meta_value_num&post_type=books’.’&paged=’.$paged);

    is there a more effective way to create a url link to order categories by meta key and value without having to create a bunch of pages for each category?

  • The topic ‘How to call for posts to be ordered by meta key and meta value?’ is closed to new replies.