How do I sort posts by page ID in this function?
-
Hi,
I’m using the WordPress Theme Daily, by theme junkie, and there is a widgetized ajax tabber that displays posts in the general sidebar.
I want to use the ‘orderby=id&include’ function to call out specific posts to be displayed.
Here is the stock code:
// Tabber: Get Most Popular Posts function tj_tabs_popular( $posts = 5, $size = 48 ) { wp_reset_query(); if(empty($posts)) $posts = 5; if(empty($size)) $size = 48; $the_query = new WP_Query('caller_get_posts=1&showposts='. $posts .'&orderby=post_date&order=asc'); while ($the_query->have_posts()) : $the_query->the_post(); ?> <li class="clear"> <?php $thumb = get_thumbnail($post->ID, get_theme_mod('thumb_key'),get_theme_mod('thumb_key')); if(!$thumb) $thumb = get_bloginfo('template_url').'/images/default-thumb.gif'; $url = get_bloginfo('template_url').'/timthumb.php?src='.$thumb.'&h='.$size.'&w='.$size.'&a=t&zc=1'; echo '<a class="entry-thumb"href="'.get_permalink().'" title=""><img width="'.$size.'" height="'.$size.'" src="'.$url.'" alt="" /></a>'; ?> <div class="info"> <a title="" href="<?php the_permalink() ?>"><?php the_title(); ?></a> </div> <!--end .info--> </li> <?php endwhile; }
When I change the line:
$the_query = new WP_Query('caller_get_posts=1&showposts='. $posts .'&orderby=post_date&order=asc');
to
$the_query = new WP_Query('caller_get_posts=1&showposts='. $posts .'&orderby=id&include=603,654,657,714,724');
nothing happens. It’s as if it doesn’t even read it, and it just keeps the old posts sorted by date in ascending order.
Can anyone tell me what I’m doing wrong?
Thanks!!!
- The topic ‘How do I sort posts by page ID in this function?’ is closed to new replies.