<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>reuse a view &#8211; Content Views Pro</title>
	<atom:link href="https://contentviewspro.com/documentation/tags/reuse-a-view/feed/" rel="self" type="application/rss+xml" />
	<link>https://contentviewspro.com/documentation</link>
	<description>Most Popular Filter &#38; Grid Plugin For WordPress</description>
	<lastBuildDate>Thu, 28 Dec 2023 08:24:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Reuse View shortcode (add parameters)</title>
		<link>https://contentviewspro.com/documentation/article/reuse-a-view/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Sun, 17 Aug 2014 10:08:00 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com//?p=116</guid>

					<description><![CDATA[This feature is only available in the Pro version. You should not reuse the views that enabled Live Filter, Shuffle Filter. Because these features don&#8217;t support the below parameters. Replace &#8220;VIEW_ID&#8221; below with ID of the View that you want to reuse. Since version 4.4.0, you can use this feature to show related posts, and &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/reuse-a-view/"> <span class="screen-reader-text">Reuse View shortcode (add parameters)</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<style>p {margin-bottom: 1em;} li {margin-bottom:5px} code {font-size:16px} blockquote {font-size: 18px} li blockquote {font-size: 16px} </style>
<blockquote><p>This feature is only available in the <a href="https://www.contentviewspro.com/#buynow" target="_blank" rel="noopener noreferrer">Pro version</a>.</p></blockquote>
<blockquote><p>You should not reuse the views that enabled Live Filter, Shuffle Filter. Because these features don&#8217;t support the below parameters.</p></blockquote>
<blockquote><p>Replace &#8220;VIEW_ID&#8221; below with ID of the View that you want to reuse.</p></blockquote>
<blockquote><p>Since version 4.4.0, you can use this feature to <a href="http://contentviewspro.com/documentation/article/show-related-posts-content-views-pro/" target="_blank" rel="noopener noreferrer">show related posts</a>, and <a href="http://contentviewspro.com/documentation/article/show-custom-field-meta-field-current-post/" target="_blank" rel="noopener noreferrer">show current post&#8217;s data</a>.</p></blockquote>
<p>Reusing helps you to use an existing view for similar purposes, without creating new views. It saves you a lot of time &amp; effort.<br />
You can reuse a View by using the View shortcode with extra parameters.<br />
These are available parameters:</p>
<ul>
<li id="reuse_complex"><strong>reuse_tax_query</strong>: reuse taxonomy settings of the existing View while adding extra parameters (cat, tag, taxonomy, taxonomy2, terms, terms2).For example: You have a view VIEW1 that filters posts IN category A. If you want to show posts IN category A, but NOT IN category B, this shortcode will help:<br />
<code>[pt_view id="VIEW1" reuse_tax_query=1 cat="B" operator="NOT IN"]</code></li>
<li><strong>cat</strong>: slug, name, ID of categories to filter.For example: you have a category with name &#8220;People&#8221;, slug &#8220;people&#8221;, ID 10.<br />
To show posts in this category, you can use one of these shortcodes:<br />
<code>[pt_view id="VIEW_ID" cat="people" field="slug"]</code><br />
<code>[pt_view id="VIEW_ID" cat="People" field="name"]</code><br />
<code>[pt_view id="VIEW_ID" cat="10" field="id"]</code></li>
<li><strong>tag</strong>: slug, name, ID of tags to filter<br />
<blockquote><p>// Show 5 posts by tag slugs<br />
<code>[pt_view id="VIEW_ID" tag="foo,bar,content" limit=5]</code><br />
// Show posts by categories &amp; tags<br />
<code>[pt_view id="VIEW_ID" cat="cat1,cat2" tag="foo,bar"]</code></p></blockquote>
</li>
<li id="taxonomy-slug"><strong>taxonomy</strong>: slug of the taxonomy to filter (use <code>taxonomy2</code> for the second taxonomy).<br />
<blockquote><p>To find the slug of a taxonomy, please look at the address bar of the browser when you visit the taxonomy page in Admin area:<br />
<img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1179" src="https://contentviewspro.com/documentation/wp-content/uploads/2014/08/Content-Views-Pro-get-slug-of-taxonomy.png" alt="" width="770" height="408" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2014/08/Content-Views-Pro-get-slug-of-taxonomy.png 770w, https://contentviewspro.com/documentation/wp-content/uploads/2014/08/Content-Views-Pro-get-slug-of-taxonomy-300x159.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2014/08/Content-Views-Pro-get-slug-of-taxonomy-768x407.png 768w" sizes="(max-width: 770px) 100vw, 770px" /></p></blockquote>
</li>
<li id="term-slug"><strong>terms</strong>: slug, name, ID of taxonomy terms (use <code>terms2</code> for terms of the second taxonomy).<br />
<blockquote><p>To find the slug of a term, please open the Category or Tag or Taxonomy page, then find value in the <strong>Slug</strong> column.</p></blockquote>
<blockquote><p>To use the assigned term of the current post, please use the value &#8220;GET_CURRENT&#8221; (<a href="https://contentviewspro.com/documentation/article/show-related-posts-content-views-pro/" target="_blank" rel="noopener">read more</a>).</p></blockquote>
<blockquote><p>To get the current term in its archive page, please use the value &#8220;GET_CURRENT_TERM&#8221;.</p></blockquote>
</li>
<li><strong>field</strong>: &#8220;slug&#8221; (default), &#8220;name&#8221;, &#8220;id&#8221;.<br />
<blockquote style="margin-top: 15px;"><p>If you use the name (or ID) of categories, tags, terms for the <code>cat</code>, <code>tag</code>, <code>terms</code> parameter, you must use <code>field="name"</code> (or <code>field="id"</code>). Otherwise, it will return &#8220;No posts found&#8221;.</p></blockquote>
</li>
<li><strong>operator</strong>: &#8220;IN&#8221; (default), &#8220;NOT IN&#8221;, &#8220;AND&#8221; (use <code>operator2</code> for operator of the second taxonomy).<br />
IN — show posts which associate with one or more of selected terms<br />
NOT IN — show posts which do not associate with any of selected terms<br />
AND — show posts which associate with all of selected terms</li>
<li><strong>relation</strong>: &#8220;AND&#8221; (default), &#8220;OR&#8221;.<br />
AND — show posts which match all settings of all taxonomies<br />
OR — show posts which match one or more settings of taxonomies</li>
<li><strong>author</strong>: ID of authors (since version 3.2)<br />
<code>[pt_view id="VIEW_ID" author="10,15"]</code></li>
<li><strong>post_type</strong>: Slug of the post type to filter (since version 3.2)</li>
<li><strong>limit</strong>: number of posts to show (since version 3.5)</li>
<li><strong>offset</strong>: number of posts to skip (since version 3.5)</li>
<li><strong>post_parent</strong>: ID of the parent page (since version 3.6.0).<br />
IDs of multiple parent pages, separate by commas (since version 5.3.4).</li>
<li><strong>keyword</strong>: keyword to search for (since version 3.9.0)<br />
<code>[pt_view id="VIEW_ID" keyword="test"]</code></li>
<li><strong>post_id</strong>: list of post IDs to show (since version 3.9.0)<br />
<code>[pt_view id="VIEW_ID" post_id="1,2,3"]</code></li>
<li id="custom_field"><strong>custom_field_value</strong>: set another values for the selected custom fields in the View.<br />
<blockquote><p>// Set new value for 1 custom field in the View<br />
<code>[pt_view id="VIEW_ID" custom_field_value="NEW_VALUE_HERE"]</code><br />
// Set new values for multiple custom fields in the View<br />
<code>[pt_view id="VIEW_ID" custom_field_value="NEW_VALUE_FOR_FIELD_1,NEW_VALUE_FOR_FIELD_2"]</code></p></blockquote>
<p>For example, in VIEW1 you filtered events have custom field <strong>_EventVenueID</strong> equals 10. Now you want to filter events have <strong>_EventVenueID</strong> equals 20, you can use this shortcode: <code>[pt_view id="VIEW1" custom_field_value="20"]</code></p>
<p>&gt;&gt; <strong>It requires that the &#8220;Value To Compare&#8221; field in existing View is <ins>not empty</ins>:</strong><br />
<img decoding="async" class="alignnone size-full wp-image-2790" src="https://contentviewspro.com/documentation/wp-content/uploads/2014/08/CVP-reuse-custom-field.png" alt="CVP - reuse custom field" width="452" height="177" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2014/08/CVP-reuse-custom-field.png 452w, https://contentviewspro.com/documentation/wp-content/uploads/2014/08/CVP-reuse-custom-field-300x117.png 300w" sizes="(max-width: 452px) 100vw, 452px" /></li>
</ul>
<hr />
<hr id="sample" />
<h2>Examples</h2>
<blockquote><p>To find value for <code>term, term2</code> =&gt; <a href="#term-slug">please check here</a>.</p></blockquote>
<blockquote><p>To find value for <code>taxonomy, taxonomy2</code> =&gt; <a href="#taxonomy-slug">please check here</a>.</p></blockquote>
<p>// Show WooCommerce products by Categories<br />
<code>[pt_view id="VIEW_ID" taxonomy="product_cat" terms="foo,bar"]</code></p>
<p>// Show WooCommerce products by Tags<br />
<code>[pt_view id="VIEW_ID" taxonomy="product_tag" terms="foo,bar"]</code></p>
<p>// Show WooCommerce products by Attributes<br />
<code>[pt_view id="VIEW_ID" taxonomy="pa_another_attribute" terms="foo,bar"]</code></p>
<hr />
<p>// Show posts match the filter settings of the VIEW1, but does not have category &#8220;foo&#8221;<br />
<code>[pt_view id="VIEW1" reuse_tax_query=1 taxonomy="category" terms="foo" operator="NOT IN"]</code></p>
<p>// Show posts have category &#8220;foo&#8221; but NOT have category &#8220;bar&#8221;<br />
<code>[pt_view id="VIEW_ID" taxonomy="category" terms="foo" operator="IN" taxonomy2="category" terms2="bar" operator2="NOT IN"]</code></p>
<p>// Show posts have category &#8220;foo&#8221; but NOT have tag &#8220;bar&#8221;<br />
<code>[pt_view id="VIEW_ID" taxonomy="category" terms="foo" operator="IN" taxonomy2="post_tag" terms2="bar" operator2="NOT IN"]</code></p>
<p>// Show posts of multiple tag IDs &amp; posts must have all selected tags<br />
<code>[pt_view id="VIEW_ID" tag="1,2,3" field="id" operator="AND"]</code></p>
<hr />
<p>// Show posts of custom taxonomy<br />
<code>[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar"]</code></p>
<p>// Show posts IN multiple taxonomies<br />
<code>[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar" taxonomy2="customer" terms2="too,tar"]</code></p>
<p>// Show posts IN one taxonomy, and NOT IN another taxonomy<br />
<code>[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar" operator="IN" taxonomy2="customer" terms2="too,tar" operator2="NOT IN"]</code></p>
<hr />
<p>Thank you,</p>
<hr />
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
