Viewing 3 replies - 1 through 3 (of 3 total)
  • I too would love to see a feature allowing the posts to be ordered alphabetically.

    Thanks,
    Brian.

    John

    (@garrettlongest)

    I would love to see this feature added automatically too, but this is what worked for me.

    Go to wp-includes>post.php and look for ‘orderby’ => ‘date’ (around line 1878) and change it to ‘orderby’ => ‘name‘.
    Then right under that change ‘order’ => ‘DESC‘ to ‘order’ => ‘ASC

    Then do the same thing (around line 3052)
    ‘orderby’ => ‘post_date‘ changed to ‘orderby’ => ‘name
    ‘order’ => ‘DESC‘ changed to ‘order’ => ‘ASC

    Hi John,

    I couldn’t get your example to work (I couldn’t find wp-includes). However, inspired by the your example, I edited the add-in code using the Editor (under Plugins on the main WordPress menu).

    I replaced the following line

    $posts = get_posts('category_name='.$category.'&posts_per_page='.$show.'&tag='.$tag.);

    with

    $posts = get_posts('category_name='.$category.'&posts_per_page='.$show.'&tag='.$tag.'&orderby=name'.'&order=ASC');

    This then produces an alphabetically sorted list (for all instances of the short code).

    I hope people find this useful.

    And thanks to John for the inspiration!!

    Brian.

    Brian Williams
    https://www.brian-coffee-spot.com

    Brian’s Coffee Spot |Devoted to Coffee

    PS To see this in action, have a look at: https://www.brian-coffee-spot.com/the-coffee-spot-guide-to/new-york-city/#List

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort in Alphabetical Order?’ is closed to new replies.