Custom Sort Code
-
I am trying to find out where I would place the array of parameters for a custom sort.
Right now I have I short code that displays a list of posts:
$q = new WP_Query ( array('meta_key' => '_count-views_all', 'orderby' => 'meta_value_num' , 'posts_per_page' => '20', 'order' => 'DESC') ); $list = '<ul class="recent-posts">'; while ($q->have_posts()) : $q->the_post(); $list .= '<li>' . get_the_date() . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '<br />' . get_the_excerpt() . '</li>'; endwhile; wp_reset_query(); return $list . '</ul>';
, but I would prefer to have this formatted like the theme. So, I want to place the it within the theme query instead of its own query like this.
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Sort Code’ is closed to new replies.