Skip to content

Instantly share code, notes, and snippets.

@yawalkar
Created February 22, 2018 10:55
Show Gist options
  • Save yawalkar/3e92c45a573d1d186eaf692a624f827c to your computer and use it in GitHub Desktop.
Save yawalkar/3e92c45a573d1d186eaf692a624f827c to your computer and use it in GitHub Desktop.
Change portfolio archive template using filter in Avada child theme
function avada_child_fusion_portfolio_archive_template( $archive_post_template ) {
$archive_portfolio_template = get_stylesheet_directory() . '/templates/archive-avada_portfolio.php';
// Checks if the archive is portfolio.
if ( is_post_type_archive( 'avada_portfolio' )
|| is_tax( 'portfolio_category' )
|| is_tax( 'portfolio_skills' )
|| is_tax( 'portfolio_tags' ) ) {
if ( file_exists( $archive_portfolio_template ) ) {
fusion_portfolio_scripts();
return $archive_portfolio_template;
}
}
return $archive_post_template;
}
// Provide archive portfolio template via filter.
add_filter( 'archive_template', 'avada_child_fusion_portfolio_archive_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment