<?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>custom PHP code &#8211; Content Views Pro</title>
	<atom:link href="https://contentviewspro.com/documentation/tags/custom-code/feed/" rel="self" type="application/rss+xml" />
	<link>https://contentviewspro.com/documentation</link>
	<description>Most Popular Filter &#38; Grid Plugin For WordPress</description>
	<lastBuildDate>Fri, 15 Mar 2024 02:30:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Show modified date instead of published date</title>
		<link>https://contentviewspro.com/documentation/article/how-to-show-the-modified-date-instead-of-the-published-date/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Sat, 18 May 2019 09:33:29 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3597</guid>

					<description><![CDATA[Content Views helps you to show posts with their information (title, thumbnail, content, date, so on) in the grid and list easily. About date, the published date will be shown by default. If you are using Content Views Pro version 5.8.0 and higher versions, you can select the option: Show the modified date instead of &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/how-to-show-the-modified-date-instead-of-the-published-date/"> <span class="screen-reader-text">Show modified date instead of published date</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views helps you to show posts with their information (title, thumbnail, content, date, so on) in the grid and list easily.<br />
About date, the published date will be shown by default.</p>
<ul>
<li>If you are using Content Views Pro version 5.8.0 and higher versions, you can select the option:<br />
</p>
<pre style="font-size:13px">
Show the modified date instead of the published date
</pre>
<p>under Display Settings >> Fields Settings >> Meta Fields.</li>
<li>If you are using Content Views Pro version 5.7.1 (and prior versions), to show the modified date instead of the published date, 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>):
<pre style="font-size:13px">
// Content Views - Show modified date
add_filter( 'pt_cv_field_meta_date_final', 'cvp_theme_field_meta_show_modified_date', 100, 2 );
function cvp_theme_field_meta_show_modified_date( $args, $utc_time ) {
	global $post;
	$args = mysql2date( get_option( 'date_format' ), $post->post_modified );
	return $args;
}
</pre>
</li>
</ul>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Glossary layout supports pagination</title>
		<link>https://contentviewspro.com/documentation/article/glossary-layout-supports-pagination/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Wed, 17 Apr 2019 04:55:22 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3580</guid>

					<description><![CDATA[The default Glossary layout doesn&#8217;t support pagination, that is ineffective when there are a lot of posts in your site. To show a glossary look-alike list, click each index will show relative posts, and support pagination, please follow instructions below: Step 1: add a custom field to every existing and upcoming posts, to store the &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/glossary-layout-supports-pagination/"> <span class="screen-reader-text">Glossary layout supports pagination</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>The default Glossary layout doesn&#8217;t support pagination, that is ineffective when there are a lot of posts in your site.<br />
To show a <ins>glossary look-alike</ins> list, click each index will show relative posts, and support pagination, please follow instructions below:</p>
<ul>
<li>Step 1: add a custom field to every existing and upcoming posts, to store the glossary index.
<p>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>
<pre style="font-size:13px">
// Content Views Pro - add custom field glossary heading for each post
add_action( 'admin_head', 'cvp_theme_add_ctf_glossary_to_exising_posts' );
function cvp_theme_add_ctf_glossary_to_exising_posts() {
    if ( !get_option( 'cvp_theme_add_ctf_glossary_index' ) ) {
        global $wpdb;
        $wpdb->query( "INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value)
  SELECT ID, 'cvp_glossary_filter', LEFT(post_title,1)
  FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type = <code style=" color: red; ">'post'</code> AND {$wpdb->posts}.post_status = 'publish'" );
        
        add_option( 'cvp_theme_add_ctf_glossary_index', 1, '', 'no' );
    }
}

add_action( 'save_post', 'cvp_theme_add_ctf_glossary_to_new_posts' );
function cvp_theme_add_ctf_glossary_to_new_posts( $post_id ) {
    if ( wp_is_post_revision( $post_id ) )
        return;

    $post_title = get_the_title( $post_id );
    update_post_meta( $post_id, 'cvp_glossary_filter', mb_substr( $post_title, 0, 1 ) );
}
// End code
</pre>
<h2>Notice:</h2>
<p>Above code works for the Post type.<br />
To use for Page type, please replace <code>'post'</code> in above code by <code>'page'</code>.<br />
To use for Custom Post type, please replace <code>'post'</code> in above code by <strong>Post Type Key</strong>, for example: <code>'product'</code> or <code>'event'</code> depends on your post type.</p>
</li>
<li>Step 2: Create a new View to show the glossary indexes, and allow visitors to filter posts by indexes.<br />
In Admin area, click Content Views > Add New menu item.</p>
<p>In <strong>Filter Settings</strong> tab of the View:</p>
<ul style="margin-left:50px">
<li>select <code>Custom Fields</code> in Advance group, then click <code>Add New</code> button. A new field will be added.</li>
<li>select <code>cvp_glossary_filter</code> for the &#8220;Field Key&#8221;</li>
<li>select the checkbox: <code>Show as filters to visitors</code></li>
<li>select the <code>Button</code> option for the Type dropdown
<p><img fetchpriority="high" decoding="async" src="https://contentviewspro.com/documentation/wp-content/uploads/2019/04/Content-Views-Pro-glossary-lookalike.png" alt="" width="788" height="410" class="alignnone size-full wp-image-3669" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2019/04/Content-Views-Pro-glossary-lookalike.png 788w, https://contentviewspro.com/documentation/wp-content/uploads/2019/04/Content-Views-Pro-glossary-lookalike-300x156.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2019/04/Content-Views-Pro-glossary-lookalike-768x400.png 768w" sizes="(max-width: 788px) 100vw, 788px" /></p>
</li>
</ul>
<p>In <strong>Display Settings</strong> tab of the View:</p>
<ul style="margin-left:50px">
<li>Select the <strong>Grid</strong> option for Layout. Please do not select the Glossary option, because it doesn&#8217;t support pagination.</li>
<li>Enable pagination</li>
</ul>
</li>
</ul>
<p>Then save the View, and add View shortcode to where you want to display it.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Prevent images from being pinned to Pinterest.com</title>
		<link>https://contentviewspro.com/documentation/article/prevent-images-in-view-from-being-pinned-to-pinterest-com/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Sun, 03 Feb 2019 06:28:39 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3547</guid>

					<description><![CDATA[Content Views helps you to show thumbnail image of posts easily. If you are installing another plugin which adds the &#8220;pin&#8221; button of Pinterest to images, but want to disable that button for images in View, please add this code to file functions.php in the theme&#8217;s folder (or install this plugin Code Snippets then add &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/prevent-images-in-view-from-being-pinned-to-pinterest-com/"> <span class="screen-reader-text">Prevent images from being pinned to Pinterest.com</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views helps you to show thumbnail image of posts easily.<br />
If you are installing another plugin which adds the &#8220;pin&#8221; button of Pinterest to images, but want to disable that button for images in View, 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>
<pre style="font-size:13px">
// Content Views Pro - Prevent images from being pinned to Pinterest
add_filter( 'pt_cv_field_thumbnail_image_html', 'cvp_theme_field_thumbnail_image_html', 100, 1 );
function cvp_theme_field_thumbnail_image_html( $args ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' ) {
		$args = str_replace('&lt;img', '&lt;img nopin = &quot;nopin&quot; data-pin-nopin=&quot;true&quot;', $args);
	}

	return $args;
}
</pre>
<p>(replace <strong>VIEW_ID</strong> with <a href="https://contentviewspro.com/documentation/article/what-is-id-of-a-view/">ID of your View</a>)</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show results of custom code, api, another plugin</title>
		<link>https://contentviewspro.com/documentation/article/show-posts-list-of-custom-code-or-another-plugin-in-content-views-pro-layout/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Tue, 06 Nov 2018 02:23:56 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3435</guid>

					<description><![CDATA[In case you used custom code to query posts, or used another plugin to get posts, you can use Content Views Pro to display these posts in a beautiful grid or list. Here is the code you need to use: $pids = array(); // #1: If there is existing variable contains array of post objects &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-posts-list-of-custom-code-or-another-plugin-in-content-views-pro-layout/"> <span class="screen-reader-text">Show results of custom code, api, another plugin</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>In case you used custom code to query posts, or used another plugin to get posts, you can use Content Views Pro to display these posts in a beautiful grid or list.<br />
Here is the code you need to use:</p>
<pre style="font-size:13px">
$pids = array();

// #1: If there is existing variable contains array of post objects
// Replace $posts by the existing variable
if ( isset( $posts ) ) {
	foreach ( $posts as $post ) {
		$pids[] = $post->ID;
	}
} 
else {
	// #2: If there is existing loop
	// Replace null by the query variable
	$query_obj = null;
	while ( $query_obj ? $query_obj->have_posts() : have_posts() ) :
		$query_obj ? $query_obj->the_post() : the_post();
		$pids[] = get_the_ID();
	endwhile;
}

// Replace VIEW_ID with the ID string of your grid/list View
echo do_shortcode('&#91;pt_view id="VIEW_ID" post_type="any" post_id="' . implode( ',', $pids ) . '"&#93;');
</pre>
<blockquote><p>Notice: Above code requires your knowledge of PHP.<br />
Also, the view should NOT enable Live Filter or any kind of other filters, it should use default Filter Settings.</p></blockquote>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Frontend filter posts by years (display yearly archives), by published date</title>
		<link>https://contentviewspro.com/documentation/article/list-posts-by-year-display-yearly-archives/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Thu, 01 Nov 2018 02:35:48 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3453</guid>

					<description><![CDATA[If you want to show list of years, and list of posts in each year, this document will help. We will leverage the live filter for the custom field to display yearly archives, with only 2 steps: Step 1: add a custom field to every existing and upcoming posts, to store the published year or &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/list-posts-by-year-display-yearly-archives/"> <span class="screen-reader-text">Frontend filter posts by years (display yearly archives), by published date</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>If you want to show list of years, and list of posts in each year, this document will help.<br />
We will leverage the live filter for the custom field to display yearly archives, with only 2 steps:</p>
<ul>
<li>Step 1: add a custom field to every existing and upcoming posts, to store the published year or date.<br />
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>
<pre style="font-size: 13px;">// Content Views Pro - add custom field to store the published year or date
$GLOBALS[ 'cvp_theme_lfdpt' ] = 'post'; // Can change to another post type
$GLOBALS[ 'cvp_theme_lfdvar' ] = 'cvp_published_year';
$GLOBALS[ 'cvp_theme_lfdtype' ] = 'year'; <strong>/** Or change to 'published_date' if you want to filter by published date */</strong>

add_action( 'admin_head', 'cvp_theme_add_ctf_dmy_to_exising_posts' );
function cvp_theme_add_ctf_dmy_to_exising_posts() {
	$option = 'cvp_theme_add_ctf_year' . $GLOBALS[ 'cvp_theme_lfdpt' ];
	if ( !get_option( $option ) ) {
		global $wpdb;
		$mval = ($GLOBALS[ 'cvp_theme_lfdtype' ] === 'published_date') ? "DATE_FORMAT(post_date_gmt, '%Y-%m-%d')" : 'YEAR(post_date_gmt)';
		$wpdb-&gt;query( "INSERT INTO {$wpdb-&gt;postmeta} (post_id,meta_key,meta_value)
  SELECT ID, '{$GLOBALS[ 'cvp_theme_lfdvar' ]}', {$mval}
  FROM {$wpdb-&gt;posts} WHERE {$wpdb-&gt;posts}.post_type = '{$GLOBALS[ 'cvp_theme_lfdpt' ]}' AND {$wpdb-&gt;posts}.post_status = 'publish'" );
		add_option( $option, 1, '', false );
	}
}

add_action( 'save_post', 'cvp_theme_add_ctf_dmy_to_new_posts' );
function cvp_theme_add_ctf_dmy_to_new_posts( $post_id ) {
	if ( !wp_is_post_revision( $post_id ) &amp;&amp; get_post_type( $post_id ) === $GLOBALS[ 'cvp_theme_lfdpt' ] ) {
		$val = ($GLOBALS[ 'cvp_theme_lfdtype' ] === 'published_date') ? 'Y-m-d' : 'Y';
		update_post_meta( $post_id, $GLOBALS[ 'cvp_theme_lfdvar' ], get_the_date( $val, $post_id ) );
	}
}
// End code
</pre>
</li>
<li>Step 2: Create a new View to show the years list, and allow visitors to filter posts by year.<br />
In Admin area, click Content Views &gt; Add New menu item.<br />
In <strong>Filter Settings</strong> tab of the View, select <code>Custom Fields</code> in Advance group, then click <code>Add New</code> button.<br />
A new field will be added, please select options as same as here:<img decoding="async" class="size-full wp-image-3835" src="https://contentviewspro.com/documentation/wp-content/uploads/2018/11/live-filter-by-year.png" alt="Content Views Pro - live filter by year" width="660" height="487" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2018/11/live-filter-by-year.png 660w, https://contentviewspro.com/documentation/wp-content/uploads/2018/11/live-filter-by-year-300x221.png 300w" sizes="(max-width: 660px) 100vw, 660px" /></p>
<blockquote><p>If you show frontend filter by <strong>published date</strong>, please select the option <strong>Date</strong> for &#8220;Value Type&#8221;.<br />
To show filters from date to date, please select the option <strong>Date Range Picker</strong> for &#8220;Type&#8221;.</p></blockquote>
</li>
</ul>
<p>Then you can save the View, and add View shortcode to where you want to display the yearly archives.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WooCommerce – show &#8220;In stock&#8221;, &#8220;Out of stock&#8221;, &#8220;On Backorder&#8221; text on products</title>
		<link>https://contentviewspro.com/documentation/article/woocommerce-show-out-of-stock-text-on-products/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Fri, 05 Oct 2018 01:43:52 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3361</guid>

					<description><![CDATA[Content Views Pro helps you to show WooCommerce products in grid and list layout easily. You might want to show in stock, out of stock, on backorder status for your products. To do that, please add this code to file functions.php in the theme&#8217;s folder (or install this plugin Code Snippets then add this code &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/woocommerce-show-out-of-stock-text-on-products/"> <span class="screen-reader-text">WooCommerce – show &#8220;In stock&#8221;, &#8220;Out of stock&#8221;, &#8220;On Backorder&#8221; text on products</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show WooCommerce products in grid and list layout easily.<br />
You might want to show in stock, out of stock, on backorder status for your products.<br />
To do that, 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>
<pre style="font-size:13px">
// Content Views Pro - Woocommerce: Display product status
add_action( 'pt_cv_item_extra_html', 'cvp_item_extra_html_wofs' );
function cvp_item_extra_html_wofs( $post_id ) {
	$product = wc_get_product( $post_id );
	if ( is_object( $product ) ) {

		// Out of stock
		if ( !$product-&gt;is_in_stock() ) {
			echo '&lt;div class=&quot;out-of-stock&quot;&gt;Out of stock&lt;/div&gt;';
		}

		// In Stock
		if ( $product-&gt;is_in_stock() ) {
			echo '&lt;div class=&quot;in-stock&quot;&gt;In stock&lt;/div&gt;';
		}

		// On Backorder
		if ( $product-&gt;is_on_backorder() ) {
			echo '&lt;div class=&quot;on-backorder&quot;&gt;On Backorder&lt;/div&gt;';
		}

	}
}
</pre>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Prevent the same posts from showing in multiple grids/lists on a page</title>
		<link>https://contentviewspro.com/documentation/article/prevent-same-posts-from-showing-in-multiple-views-on-same-page/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Tue, 04 Sep 2018 07:51:05 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3477</guid>

					<description><![CDATA[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 &#8230;<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 &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<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 />
In 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>
<pre style="font-size:13px">
// Content Views Pro - prevent same posts appear in multi Views on same page
$GLOBALS['cvp_shown_posts'] = array();
add_action( 'pt_cv_after_process_item', 'cvp_theme_after_process_item1' );
function cvp_theme_after_process_item1() {	
	if ( isset( $GLOBALS[ 'cv_posts' ] ) ) {
		$GLOBALS['cvp_shown_posts'] = array_merge( $GLOBALS['cvp_shown_posts'], array_keys( $GLOBALS[ 'cv_posts' ] ) );
	}
}
add_filter( 'pt_cv_post__not_in', 'cvp_theme_post__not_in1', 100, 2 );
function cvp_theme_post__not_in1( $args, $settings ) {	
	$args = array_merge( $args, $GLOBALS['cvp_shown_posts'] );
	return $args;
} // end
</pre>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show recurring events of Events Manager plugin</title>
		<link>https://contentviewspro.com/documentation/article/show-recurring-events-events-manager-plugin/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Thu, 23 Aug 2018 08:36:56 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3253</guid>

					<description><![CDATA[The Events Manager plugin considers normal events and recurring events are 2 different post types. Content Views Pro can help you to show events of the Events Manager plugin easily (read more). The recurring events are not publicly queryable by default. So you won&#8217;t see the &#8220;Recurring Events&#8221; as an option of the &#8220;Content Type&#8221; &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-recurring-events-events-manager-plugin/"> <span class="screen-reader-text">Show recurring events of Events Manager plugin</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>The Events Manager plugin considers normal events and recurring events are 2 different post types.<br />
Content Views Pro can help you to show events of the Events Manager plugin easily (<a href="https://contentviewspro.com/documentation/article/show-events-events-manager-plugin/" rel="noopener noreferrer" target="_blank">read more</a>).<br />
The recurring events are not publicly queryable by default. So you won&#8217;t see the &#8220;Recurring Events&#8221; as an option of the &#8220;Content Type&#8221; setting when creating a View. </p>
<p>To make recurring events publicly queryable, 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>
<pre style="font-size:13px">
add_filter( 'em_cp_event_recurring_public', '__return_true' );
add_filter( 'em_cp_event_recurring_publicly_queryable', '__return_true' );
</pre>
<p>Then in a View, you can select &#8220;Recurring Events&#8221; as option of &#8220;Content Type&#8221; to show recurring events.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show more information of ACF post object custom field</title>
		<link>https://contentviewspro.com/documentation/article/show-custom-field-show-info-acf-post-object/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Thu, 09 Aug 2018 03:49:11 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3234</guid>

					<description><![CDATA[Content Views Pro helps you to show custom fields easily. When showing a post object custom field of the Advanced Custom Fields plugin, Content Views Pro will show the title of the object by default. To show more info of the object, please add this code to file functions.php in the theme&#8217;s folder (or install &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-custom-field-show-info-acf-post-object/"> <span class="screen-reader-text">Show more information of ACF post object custom field</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show custom fields easily.<br />
When showing a <a href="https://www.advancedcustomfields.com/resources/post-object/" rel="noopener nofollow noreferrer" target="_blank">post object custom field</a> of the Advanced Custom Fields plugin, Content Views Pro will show the title of the object by default.<br />
To show more info of the object, 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>
<pre style="font-size:13px">
add_filter( 'pt_cv_acf_post_object_html', 'cvp_theme_acf_post_object_html', 100, 2 );
/**
 * Content Views Pro - show more info of ACF post object
 * @param string $args The output of this ACF field (default output is the post title)
 * @param object $post The post object
 * @return string
 */
function cvp_theme_acf_post_object_html( $args, $post ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' ) {
		// For example: show thumbnail before title
		$args = get_the_post_thumbnail( $post->ID ) . $args;
	}

	return $args;
}
</pre>
<p>(replace <strong>VIEW_ID</strong> with <a href="https://contentviewspro.com/documentation/article/what-is-id-of-a-view/">ID of your View</a>)</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add &#8220;title&#8221; attribute to links</title>
		<link>https://contentviewspro.com/documentation/article/add-title-attribute-links/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Wed, 04 Jul 2018 02:08:54 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3196</guid>

					<description><![CDATA[For SEO purposes, many researches state that title attribute might not be given much weight in ranking. For user&#8217;s experience, the title attribute can provide descriptive text (or supplementary information) to the link. To add title attribute to links in grid or list of Content Views, please add this code to file functions.php in the &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/add-title-attribute-links/"> <span class="screen-reader-text">Add &#8220;title&#8221; attribute to links</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>For SEO purposes, many researches state that title attribute might not be given much weight in ranking.<br />
For user&#8217;s experience, the title attribute can provide descriptive text (or supplementary information) to the link.</p>
<p>To add title attribute to links in grid or list of Content Views, 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>
<pre style="font-size:13px">
// Content Views Pro - add Title attribute to images
add_filter( 'wp_get_attachment_image_attributes', 'cv_add_tilte_for_image', 100, 3 );
function cv_add_tilte_for_image( $attr, $attachment, $size ) {
	global $cvp_process_settings;
	if ( $cvp_process_settings ) {
		global $post;
		// Get title of featured image first, then get the title of post
		$title			 = isset( $attachment->post_title ) ? $attachment->post_title : (isset( $post->post_title ) ? $post->post_title : '');
		$attr[ 'title' ] = esc_attr( $title );
	}
	return $attr;
}

// Content Views Pro - add Title attribute to links
add_filter( 'pt_cv_field_href_attrs', 'cvp_theme_add_title_to_links', 100, 3 );
function cvp_theme_add_title_to_links( $custom_attr, $open_in, $oargs = array() ) {
	global $post;
	if ( isset( $post->post_title ) ) {
		$custom_attr[] = 'title="' . esc_attr( $post->post_title ) . '"';
	}
	return $custom_attr;
}

</pre>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
