• Resolved goldmember

    (@goldmember)


    i’m using the code below on the homepage of this site: https://www.goldcoastchamber.com.

    <h2>Upcoming Events</h2>
    <?php $recent = new WP_Query("cat=3&orderby=post_name&order=ASC"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?></a>
    <?php endwhile; ?>

    for the most part, the code works, but i have it setup so that all the posts should appear in ascending alphabetical order, by the post name. but how come the last posting “5/20/10…” is listed last when it should be second, alphabetically?????

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using orderby=title.

    Thread Starter goldmember

    (@goldmember)

    thanks. that kinda works but not really for my purposes here. the problem is its now sorting by the very first character so its putting the october (10) event at the top, though i need that at the bottom.

    any ideas?

    Thread Starter goldmember

    (@goldmember)

    so i figured out a way. i put zeros in front of the single digit months and that seems to have done the trick.

    Thread Starter goldmember

    (@goldmember)

    i take it back. i’m still having issues. if you look on the Upcoming Events Page (https://www.goldcoastchamber.com/?page_id=31) which has the code below to generate the content, you’ll see that the last post on the page, should actually be the second, since its title starts with
    “05/20/10”. so how come it’s out of order????

    <h2>Upcoming Events</h2>
    <?php $recent = new WP_Query("cat=3&order=ASC"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?>
    </a>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <br />
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘recent posts not being ordered the way i structured it too’ is closed to new replies.