Figured out a solution – here’s the code I used to target the dynamic template but exclude regular portfolio pages:
function loop_portfolio_query( $location ) {
if(avia_is_dynamic_template_active()) {
global $avia_config;
if(isset($avia_config['new_query'])) {
$avia_config['new_query']['orderby'] = "rand";
query_posts($avia_config['new_query']);
}
}
}
add_action( 'avia_action_query_check' , 'loop_portfolio_query', 10, 1 );
I’m using Flagship. This works, but it randomizes all of the portfolio items on every page. I need to target just the home page, which uses the dynamic template. I’ve tried the following and none seem to affect the home page only: is_home, is_front_page, is_page(28). Is there some other way to target it conditionally?
The page I’m working on is here: http://csam.awfulcool.com
If I can piggyback on this question – I’d like to randomize the portfolio items displayed using the Frontpage Template (created with the Template Builder). This code doesn’t seem to affect those items; can you tell me what condition I should be using to target ONLY the query for portfolio items using the Frontpage custom template?