StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-07-2011, 10:55 AM
reckoner41 reckoner41 is offline
Registered User
Pro Plus Member
 
Join Date: Oct 2011
Posts: 38
Default Post order by meta value and then date

Hi,

I am working on setting up a category page with featured posts first by assigning them an order based on a custom value 'featured' and a number value (1,2,3 etc).

My php is a bit rusty and this is what I have right now, the problem is that it only shows posts that have a featured custom value. If there is none assigned then it won't show in the category. I would prefer to show the three featured items first, then have a full list below, maybe by alpha order, maybe by date or whatever I choose.

What do I need to add to the query to make this happen.

Thanks in advance.


/** order by featured */

add_action('genesis_before_loop', 'custom_sort');
function custom_sort () {
if (is_category('3')) {
global $query_string;
query_posts($query_string . "&orderby=meta_value&meta_key=featured&order=asc") ;
}
}
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:15 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.