• rrusch

    (@rrusch)


    I am using the code below to order my posts by the amount of views it has.

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

    By changing the meta_key to ‘_likes’ I can order posts by the amount of likes it has.

    I want the user to be able to choose between views and likes with a simple drop down menu or buttons.

    I’ve searched and searched for a way to do this but cant find any solutions!

  • The topic ‘Let user order posts by meta key’ is closed to new replies.