WordPress.org

Ready to get started?Download WordPress

Forums

How to call for posts to be ordered by meta key and meta value? (1 post)

  1. chea24
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.