Modify Slider Code in Trim Theme to display Popular Posts instead of Category
-
(Not sure if this is the correct forum for this question?)
I am using the Trim Theme by Elegant Themes. I like the slider in this theme, but would like to modify the code a bit to change the query criteria from (currently) a specific category to (instead) popular posts.
Thing is, this theme comes with an epanel from which I can choose whichever category I wish to use as criteria…so there is something very dynamic going on (it’s not just coded specifically for one category). I’m not sure how to approach – i.e., where to even begin looking to make the change.
I have found a “featured.php” file that seems to be doing most of the work. Apparently the code is looking for whatever has been defined as the “featured” category (defined by the user).
I want to query based on popular posts. This is the code I *think* I should be looking at:
<div id="featured" class="flexslider<?php echo $featured_slider_class; ?>"> <ul class="slides"> <?php global $wp_embed, $ids; $ids = array(); $arr = array(); $i=1; $bottom_tabs_content = ''; $featured_cat = get_option('trim_feat_cat'); $featured_num = get_option('trim_featured_num'); if (get_option('trim_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_catId($featured_cat));( 'orderby' => 'comment_count' ) else { global $pages_number; if (get_option('trim_feat_pages') <> '') $featured_num = count(get_option('trim_feat_pages')); else $featured_num = $pages_number; query_posts(array ('post_type' => 'page', 'orderby' => 'menu_order', 'order' => 'ASC', 'post__in' => (array) get_option('trim_feat_pages'), 'showposts' => (int) $featured_num) );
And, within that, specifically this:
if (get_option('trim_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_catId($featured_cat));
I think I need to alter this somewhat to query posts by those with the most comments…Looking at the codex I see this as a query:
$query = new WP_Query( array( 'orderby' => 'comment_count' ) );
I tried changing the original “query_posts(“showposts…blahblah) to instead contain the ‘orderby’ and ‘comment_count’, but that did not work…most likely because I really have no idea what I’m doing right here ??
Any suggestions?
Thanks!
- The topic ‘Modify Slider Code in Trim Theme to display Popular Posts instead of Category’ is closed to new replies.