{"id":2367,"date":"2017-05-10T10:25:27","date_gmt":"2017-05-10T10:25:27","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=2367"},"modified":"2023-12-29T04:13:32","modified_gmt":"2023-12-29T04:13:32","password":"","slug":"replace-layout-in-themes-use-the-gantry-framework","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/replace-layout-in-themes-use-the-gantry-framework\/","title":{"rendered":"Replace layout in RocketTheme themes (use the Gantry framework)"},"content":{"rendered":"<p>The Replace Layout feature of Content Views Pro doesn&#8217;t work automatically with RocketTheme themes (which use the Gantry framework).<\/p>\n<p>To replace layout of archive pages (category, tag, taxonomy, author) and search results page in RocketTheme themes, please add this code to file <strong>functions.php<\/strong> in the theme&#8217;s folder:<\/p>\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - replace layout of archive pages, search results page\nadd_filter( 'timber_compile_result', 'cvp_theme_replace_archive_layout' );\nfunction cvp_theme_replace_archive_layout( $args ) {\n\tif ( (is_search() || is_archive()) &amp;&amp; shortcode_exists( 'pt_view' ) ) :\n\t\t$pids = array();\n\t\tforeach ( Timber::get_posts() as $post ) {\n\t\t\t$pids[] = $post->ID;\n\t\t}\n\t\t$view = do_shortcode( '&#91;pt_view id=\"VIEW_ID\" post_id=\"' . implode( ',', $pids ) . '\"&#93;' );\n\n\t\t$html\t = '&lt;section class=&quot;entries&quot;&gt;' . $view;\n\t\t$args\t = preg_replace( '\/&lt;section\\sclass=&quot;entries&quot;.*&lt;\\\/article&gt;\/s', $html, $args );\n\tendif;\n\n\treturn $args;\n}\n<\/pre>\n<p>Please replace <strong>VIEW_ID<\/strong> with ID of the View (which you want to use to replace layout of pages).<\/p>\n<blockquote><p>Notice: When replacing layout of RocketTheme themes, the <code>Filter Settings<\/code> and <code>Pagination<\/code> setting of the View will NOT be supported.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The Replace Layout feature of Content Views Pro doesn&#8217;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&#8217;s folder: \/\/ Content Views Pro &#8211; replace layout of &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/replace-layout-in-themes-use-the-gantry-framework\/\"> <span class=\"screen-reader-text\">Replace layout in RocketTheme themes (use the Gantry framework)<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[62],"doc_tag":[21,10],"class_list":["post-2367","docs","type-docs","status-publish","hentry","doc_category-other-plugins","doc_tag-custom-code","doc_tag-replace-layout"],"year_month":"2026-09","word_count":186,"total_views":"3","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Other Plugins","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/other-plugins\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"},{"term_name":"replace layout","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/replace-layout\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=2367"}],"version-history":[{"count":1,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2367\/revisions"}],"predecessor-version":[{"id":5615,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2367\/revisions\/5615"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=2367"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=2367"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=2367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}