Support » Plugin: Advanced Recent Posts Widget » Option to sort by post slug

Viewing 2 replies - 1 through 2 (of 2 total)
  • Ok, I tried replacing
    <option value="title"<?php selected( $instance["sort_by"], "title" ); ?>>Title</option>
    <option value="name"<?php selected( $instance["sort_by"], "name" ); ?>>Name (post slug)</option>


    This should have caused the orderby variable for the $my_args to be “name” instead of “title” in the WP_Query.

    But it didn’t work. The recent post now are just ordered by date but reverse.

    PS: I looked up the values in the database and it clearly states:

    Yay, I got it.

    You also need to change the following line:
    $default_sort_orders = array('date', 'title', 'comment_count', 'rand');
    $default_sort_orders = array('date', 'name', 'comment_count', 'rand');

    Or maybe not. 😉 It works now. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Option to sort by post slug’ is closed to new replies.