Replace layout of archive pages in themes which use the Gantry framework

The Replace Layout feature of Content Views Pro doesn’t work automatically with themes which use the Gantry framework (by RocketTheme).
To replace layout of archive pages (category, tag, taxonomy, author) in these themes, please add this code to file functions.php of your active theme:

// Content Views Pro - replace layout of archive pages
add_filter( 'timber_compile_result', 'cvp_theme_replace_archive_layout' );
function cvp_theme_replace_archive_layout( $args ) {
	if ( is_archive() && method_exists( 'PT_CV_Functions_Pro', 'view_overwrite_tpl' ) ) :
		$view	 = PT_CV_Functions_Pro::view_overwrite_tpl( array( 'id' => 'VIEW_ID', 'posts' => Timber::get_posts(), 'rebuild' => true ) );
		$html	 = '<section class="entries">' . $view;
		$args	 = preg_replace( '/<section\sclass="entries".*<\/article>/s', $html, $args );
	endif;

	return $args;
}

Please replace VIEW_ID with ID of the View which you want to use to replace layout of pages.

Best regards,