The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Modify Slider Code in Trim Theme to display Popular Posts instead of Category (3 posts)

  1. jeanne38654
    Posted 4 years ago #

    (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">
    		global $wp_embed, $ids;
    		$ids = array();
    		$arr = array();
    		$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;
    							('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?


  2. esmi
    Forum Moderator
    Posted 4 years ago #

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's vendors.

  3. jeanne38654
    Posted 4 years ago #

    Some things are beyond the scope of vendor's support forums. I didn't realize, though, that I shouldn't seek help on this type of question here. :)

    What I need to do is just scrap the slider and replace with another one with the functionality I need. Googling now, but if you (or anyone else reading this) can recommend a good slider plugin that allows "popular posts" as a criteria for slides, please advise!


Topic Closed

This topic has been closed to new replies.

About this Topic