Support » Theme: Hueman » Criteria for popular post widget.

  • Hi, I like to know criteria for popular post in “Hueman Dynamic tab>Most Popular” Tab. and also, can we change the criteria for this tab?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi mmshahid. It’s based on the post comment counts. There isn’t a theme option for that but you can change it manually by adding /functions/widgets/alx-tabs.php to the same path in a child theme, then locating the popular posts section and changing the query criteria:

    <?php if($instance['popular_enable']) { // Popular posts enabled? ?>
    
    <?php
    	$popular = new WP_Query( array(
    		'post_type'		=> array( 'post' ),
    		'showposts'		=> $instance['popular_num'],
    		'cat'			=> $instance['popular_cat_id'],
    		'ignore_sticky_posts'	=> true,
    		'orderby'		=> 'comment_count',
    		'order'			=> 'dsc',
    		'date_query' => array(
    			array(
    				'after' => $instance['popular_time'],
    			),
    		),
    	) );
    ?>

    If you don’t have a child theme you can easily install one by following this guide from the theme website:
    http://docs.presscustomizr.com/article/239-using-a-child-theme-with-hueman

    • This reply was modified 2 years, 7 months ago by  bdbrown.
    • This reply was modified 2 years, 7 months ago by  bdbrown.

    Hi, the ordering criteria for the popular tab is the number of comments.

    Ha! @nikeo and I are typing at the same time, even though we’re on opposite sides of the globe!

    @bdbrown crossed replies !
    Yours is much more complete 🙂

    Thanks for both of you 🙂

    You’re welcome; glad to help.

    Hi, i done same as you advised, it looks like that:

    		<?php if($instance['popular_enable']) { // Popular posts enabled? ?>
    
    			<?php
    				$popular = new WP_Query( array(
    					'post_type'				=> array( 'post' ),
    					'showposts'				=> $instance['popular_num'],
    					'cat'					=> $instance['popular_cat_id'],
    					'ignore_sticky_posts'	=> true,
    					'meta_key'				=> 'views',
    					'orderby'				=> 'meta_value_num',
    					'order'					=> 'dsc',
    					'date_query' => array(
    						array(
    							'after' => $instance['popular_time'],
    						),
    					),
    				) );
    			?>

    I tried to set Most Popular by Post view, but the above seams to not working properly, any advise?

    Order should be ‘DESC’.

    I have a column “Hits” in my databae, is this enugh to add “Hits” to display Popular posts based on most Hits?

    <?php
    				$popular = new WP_Query( array(
    					'post_type'				=> array( 'post' ),
    					'showposts'				=> $instance['popular_num'],
    					'cat'					=> $instance['popular_cat_id'],
    					'ignore_sticky_posts'	                => true,
    					'meta_key'				=> 'hits',
    					'orderby'				=> 'meta_value_num',
    					'order'					=> 'desc',
    					'date_query' => array(
    						array(
    							'after' => $instance['popular_time'],
    						),
    					),
    				) );
    			?>

    Not sure. Where did that come from?

    This column is a part of “JetPack” belongs to WP-Statistic.

    If it’s a custom field associated with a post then yes, theoretically it should work.

    Hi, guys.
    How can I use Custom Fields for this purpose? I mean use Custom Field value instead of comments number. What shall I change in this code

    • This reply was modified 2 years, 6 months ago by  steelinside.
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Criteria for popular post widget.’ is closed to new replies.