Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #199141

    Hi,

    The Coherence latest portfolio Widget is great, but is it possible to have a similar widget with exactly the same settings but displays a random set of portfolio items rather than the latest. I know this isn’t built in, but if anyone can at least point me in the right direction on how to achieve this I would be most grateful.

    #199458

    Hey 13adger!

    You can modify the portfolio widget query to change the order parameter to “random”. However this change will affect all portfolio widgets. Open up /wp-content/themes/coherence/framework/php/class-framework-widgets.php and search for

    
    						$new_query = array(	"posts_per_page"=>$count, 'tax_query' => array(
    														array( 'taxonomy' => $this->avia_term,
    															   'field' => 'id',
    															   'terms' => explode(',', $cat),
    															   'operator' => 'IN')
    															  )
    														);
    

    Replace the code with

    
    						$new_query = array(	'orderby' => 'rand', "posts_per_page"=>$count, 'tax_query' => array(
    														array( 'taxonomy' => $this->avia_term,
    															   'field' => 'id',
    															   'terms' => explode(',', $cat),
    															   'operator' => 'IN')
    															  )
    														);
    

    and the portfolio post query order should be random.

    Cheers!
    Peter

    #199477

    Fantastic, Thanks for the help

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Coherence Latest Portfolio Widget -> Coherence Random Portfolio Widget’ is closed to new replies.