Replace layout in RocketTheme themes (use the Gantry framework)

The Replace Layout feature of Content Views Pro doesn’t work automatically with RocketTheme themes (which use the Gantry framework).

To replace layout of archive pages (category, tag, taxonomy, author) and search results page in RocketTheme themes, please add this code to file functions.php in the theme’s folder:

// Content Views Pro - replace layout of archive pages, search results page
add_filter( 'timber_compile_result', 'cvp_theme_replace_archive_layout' );
function cvp_theme_replace_archive_layout( $args ) {
	if ( (is_search() || 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() ) );
		$html	 = '<section class="entries">' . $view;
		$args	 = preg_replace( '/<section\sclass="entries".*<\/article>/s', $html, $args );

	return $args;

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

Notice: When replacing layout of RocketTheme themes, the Filter Settings and Pagination setting of the View will NOT be supported.