The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Why won't my posts sort by post_name (slug)? (4 posts)

  1. buskerdog
    Posted 10 years ago #

    Here's my code:
    <?php get_posts('orderby=post_name&order=DESC'); ?>
    <ul class="menubox"><?php while (have_posts('')) : the_post(''); ?>

    <li><a href="<?php the_permalink() ?>"><?php the_excerpt(); ?><?php the_title(); ?></a></li>
    <?php endwhile; ?>

    and here's my URL: http://tinyurl.com/lof3u (please don't post the actual URL, I don't want the thread to cache on google)

    What am I doing wrong? I made the post slugs just the last names so that I could sort the page alphabetically... and I can't figure out how to make it happen.

  2. buskerdog
    Posted 10 years ago #

    no one knows this?

  3. Michael Bishop

    Posted 10 years ago #

    I don't think you can pass those parameters to get_post

    Take a look at this

  4. virgvv
    Posted 9 years ago #

    I'm having the same problem. I've got a category archive of author names, and want to sort on the slug (last name). I'm using query_posts rather than get_posts, like so:

    Is it really impossible to sort posts by slug?

    Or am I just missing something?


Topic Closed

This topic has been closed to new replies.

About this Topic