How to sort on a custom field then subsort by date?
-
I am new to php and WordPress. I am fairly experienced with VB Script and Classic ASP 3.0.
I have transformed an existing site from ASP to WordPress CMS and all has gone pretty much as planned apart from needding to create a list which is sorted first by a custom field Client_Type and then by date.
THe category page contains one of these for each different value in the Client_Type custom field. Clicking through to the single.php page I want the backward and forward navigation to run through the pages in groups from wherever the entry point is i.e. if I had 8 dates in 3 groups:
Group1, date3,date5,date6 <=> Group2 Date1,date2 <=> Group3, date4,date7,date8The code for the query is here:
<h2 class="restaurantandpubs"><span>Restaurants & Pubs</span></h2> <?php query_posts('cat=3&meta_key=Client_Type&meta_value=Restaurants&showposts=-1&orderby=Client-Type&order=DESC'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h3 class="casetitles"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <?php endwhile; ?> <?php endif; ?>
I would be very grateful if someone could help me with this so I can finish the site off.
Thanks in advance,
Nigel
- The topic ‘How to sort on a custom field then subsort by date?’ is closed to new replies.