{"id":3477,"date":"2018-09-04T07:51:05","date_gmt":"2018-09-04T07:51:05","guid":{"rendered":"https:\/\/docs.contentviewspro.com\/?p=3477"},"modified":"2023-12-28T08:04:30","modified_gmt":"2023-12-28T08:04:30","password":"","slug":"prevent-same-posts-from-showing-in-multiple-views-on-same-page","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/prevent-same-posts-from-showing-in-multiple-views-on-same-page\/","title":{"rendered":"Prevent the same posts from showing in multiple grids\/lists on a page"},"content":{"rendered":"<p>You can show as many Views on a page as you want. Each View will return a list of posts which match its &#8220;Filter Settings&#8221; configuration. There is a possible case that a same post appears in different Views, because it matches the Filter Settings of these Views.<br \/>\nIn case you want to prevent same posts from showing in multiple Views on same page, please add this code to file <strong>functions.php<\/strong> in the theme&#8217;s folder (or install this plugin <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" rel=\"nofollow\">Code Snippets<\/a> then add this code to <a href=\"https:\/\/ps.w.org\/code-snippets\/assets\/screenshot-2.png\" rel=\"nofollow\">the &#8220;Code&#8221; textarea<\/a>):<\/p>\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - prevent same posts appear in multi Views on same page\n$GLOBALS['cvp_shown_posts'] = array();\nadd_action( 'pt_cv_after_process_item', 'cvp_theme_after_process_item1' );\nfunction cvp_theme_after_process_item1() {\t\n\tif ( isset( $GLOBALS[ 'cv_posts' ] ) ) {\n\t\t$GLOBALS['cvp_shown_posts'] = array_merge( $GLOBALS['cvp_shown_posts'], array_keys( $GLOBALS[ 'cv_posts' ] ) );\n\t}\n}\nadd_filter( 'pt_cv_post__not_in', 'cvp_theme_post__not_in1', 100, 2 );\nfunction cvp_theme_post__not_in1( $args, $settings ) {\t\n\t$args = array_merge( $args, $GLOBALS['cvp_shown_posts'] );\n\treturn $args;\n} \/\/ end\n<\/pre>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can show as many Views on a page as you want. Each View will return a list of posts which match its &#8220;Filter Settings&#8221; configuration. There is a possible case that a same post appears in different Views, because it matches the Filter Settings of these Views. In case you want to prevent same &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/prevent-same-posts-from-showing-in-multiple-views-on-same-page\/\"> <span class=\"screen-reader-text\">Prevent the same posts from showing in multiple grids\/lists on a page<\/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":[25],"doc_tag":[21],"class_list":["post-3477","docs","type-docs","status-publish","hentry","doc_category-adjustment","doc_tag-custom-code"],"year_month":"2026-09","word_count":182,"total_views":"2","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":"Adjustment","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/adjustment\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/3477","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=3477"}],"version-history":[{"count":1,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/3477\/revisions"}],"predecessor-version":[{"id":5473,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/3477\/revisions\/5473"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=3477"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=3477"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=3477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}