WordPress.org

Ready to get started?Download WordPress

Forums

orderby isn't working (8 posts)

  1. csleh
    Member
    Posted 5 years ago #

    Using this code:

    <?php
       if (is_page('partners'))  { ?>
    <?php $temp_query = $wp_query; ?>
    <?php query_posts('cat=10&orderby=title&order=ASC'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_content(); ?>
    
    <?php endwhile; ?>
     <?php }
    ?>

    I expected alphabetical. My goal is actually reverse alphabetical, but this isn't even showing "a" first. View it here:
    http://www32.a2hosting.com/~mpallas/who-we-are/partners/
    NO posts in this category are set to sticky.

  2. eric211c
    Member
    Posted 5 years ago #

    I am having the same problem, any word on this?

  3. Ogre
    Member
    Posted 5 years ago #

    What isn't sorting alphabetically? Everything I looked at on that page looked sorted. FYI, to reverse sort: order=DESC

  4. csleh
    Member
    Posted 5 years ago #

    Link change:
    http://www.lighthouseconsultingpartners.com/who-we-are/partners/

    I don't see the sorting. I see:

    Detroit Chamber of Commerce
    Institute of Management Consultants
    Association for Computing Machinery
    International Association for Outsourcing Professionals

    But 'A' should come before 'I' if were sorting alphabetically.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    If you're not getting sorting, then I'd say your query is not getting executed properly, because that code is correct. orderby=title should work perfectly.

    Can you post more of the page than just the snippet? Use http://wordpress.pastebin.com and post the link back here.

  6. csleh
    Member
    Posted 5 years ago #

    I was experimenting with using one template for many page types, so would be great to know how I'm screwing up.

    http://wordpress.pastebin.com/m5dc931c5

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Hmmm.. Weird. Are you sure that this code is actually getting used? Is this like in your page.php file or what?

  8. csleh
    Member
    Posted 5 years ago #

    yes, this is page.php. I assume the code is being used, since category 10 (the partner listing) is shown. I don't know how to test that though.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags