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 03-31-2010, 01:52 PM
ashley3ee's Avatar
ashley3ee ashley3ee is offline
Registered User
Pro Plus Member
 
Join Date: Jun 2009
Location: Temecula, California
Posts: 63
Question Sort Featured Posts by Custom Field

Is there a way to be able to sort the list of featured posts I have on the home page by a custom field, such as an expiration date? The name of the custom field is expiration-date, and I want it to sort by the value in ASC order.

Here is the code that is there now:

Code:
<?php $recent = new WP_Query("cat=".get_theme_mod('featured_top_left')."&showposts=".get_theme_mod('featured_top_left_num').); while($recent->have_posts()) : $recent->the_post(); ?>
				<?php if( get_post_meta($post->ID, "thumb", true) ): ?>
				<a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&amp;h=<?php echo get_theme_mod('featured_top_left_thumb_height'); ?>&amp;w=<?php echo get_theme_mod('featured_top_left_thumb_width'); ?>&amp;zc=1" alt="<?php the_title(); ?>" /></a>	
				<?php else: ?>
				<?php endif; ?>					
                
				<strong><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></strong>
				<?php the_content_limit(90, ""); ?>
				
				<hr/>
				
				<?php endwhile; ?>
                
				<?php if(get_theme_mod('featured_top_left')) : ?>
				<strong><a href="<?php echo get_category_link(get_theme_mod('featured_top_left')); ?>" rel="bookmark"><?php _e("Read more posts from ", 'studiopress'); echo get_cat_name(get_theme_mod('featured_top_left')); ?></a></strong>
			
				<?php endif; ?>
 

Tags
custom fields, featured posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by Custom Field dredogg General Discussion 4 06-16-2010 06:21 PM
Sort postings by custom date field dredogg General Discussion 3 06-14-2010 04:24 PM


All times are GMT -5. The time now is 11:28 PM.

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