• Resolved Gloria

    (@erfo)


    Hi.
    I use this code for last articles from a category:

    <?php $myposts = get_posts('numberposts=150&category=130');
    foreach($myposts as $post) : ?>
    <b>&raquo;</b> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endforeach; ?>

    and it’s ok.
    But, when I add &orderby=name or &orderby=title :
    ('numberposts=150&category=130&orderby=title');
    titles are not sorted by letter

    How can I do to get the latest articles from a category in alphabetical order?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • This worked fine for me, at least with no plugins and using the WordPress Default theme:

    <?php $myposts = get_posts('numberposts=150&category=130&orderby=title&order=ASC');
    foreach($myposts as $post) : ?>
    <b>&raquo;</b> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endforeach; ?>
    Thread Starter Gloria

    (@erfo)

    Ok perfect, now it works.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Last post from a category in alphabetical order’ is closed to new replies.