<?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 field &#8211; Content Views Pro</title>
	<atom:link href="https://contentviewspro.com/documentation/tags/custom-field/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, 21 Aug 2025 08:26:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Set link text when showing an URL custom field</title>
		<link>https://contentviewspro.com/documentation/article/custom-text-url-custom-field/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Wed, 11 Oct 2017 05:06:42 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=2340</guid>

					<description><![CDATA[If you are showing a custom field which has an URL string as value, for example: http://google.com Content Views Pro will convert that URL string to a HTML link (anchor tag): http://google.com How to use a custom text for the link? There are 2 possible ways: 1. Manually replace the URL string in the value &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/custom-text-url-custom-field/"> <span class="screen-reader-text">Set link text when showing an URL custom field</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>If you are showing a custom field which has an URL string as value, for example:</p>
<pre style="font-size:13px">
http://google.com
</pre>
<p>Content Views Pro will convert that URL string to a HTML link (anchor tag):<br />
<a target="_blank" href="http://google.com" rel="noopener noreferrer">http://google.com</a></p>
<p>How to <strong>use a custom text for the link</strong>?<br />
There are 2 possible ways:</p>
<p>1. Manually replace the URL string in the value of custom field by an anchor tag:</p>
<pre style="font-size:13px">
&lt;a target=&quot;_blank&quot; href=&quot;http://google.com&quot;&gt;YOUR TEXT HERE&lt;/a&gt;
</pre>
<p>2. Dynamically replace the URL string by an anchor tag using PHP code.<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 - custom text for URL custom fields
add_filter( 'pt_cv_ctf_url_text', 'cvp_theme_ctf_url_text', 100, 2 );
function cvp_theme_ctf_url_text( $args, $key ) {
	if ( $key === 'CUSTOM_FIELD_1' ) {
		$args = 'Text1';
	}
	if ( $key === 'CUSTOM_FIELD_2' ) {
		$args = 'Text2';
	}
	if ( $key === 'CUSTOM_FIELD_3' ) {
		$args = 'Text3';
	}

	return $args;
}
</pre>
<p>(replace <strong>CUSTOM_FIELD_1, CUSTOM_FIELD_2, CUSTOM_FIELD_3</strong> with your custom field keys. If you have only one custom field, just replace CUSTOM_FIELD_1 with your custom field key.)</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add custom field to posts, pages</title>
		<link>https://contentviewspro.com/documentation/article/add-new-custom-field-wordpress-post/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Fri, 15 Sep 2017 05:15:55 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=2127</guid>

					<description><![CDATA[WordPress has the ability to assign custom fields to a post. Each custom field is handled with key/value pairs. The key is the name of the custom field. The value is the information that you want to store in that custom field. To add a new custom field to a WordPress post, you need to &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/add-new-custom-field-wordpress-post/"> <span class="screen-reader-text">Add custom field to posts, pages</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<style>h5 {margin: 20px 0;}</style>
<p>WordPress has the ability to assign custom fields to a post. Each custom field is handled with key/value pairs. The key is the name of the custom field. The value is the information that you want to store in that custom field.</p>
<p>To add a new custom field to a WordPress post, you need to <ins>edit the post</ins>.<br />
In the post editing page:</p>
<ul>
<li>scroll down to the area titled <strong>Custom Fields</strong></li>
<li>enter name and value of the custom field to the <strong>Name</strong> and <strong>Value</strong> columns</li>
<li>click <strong>Add Custom Field</strong> button to save this custom field</li>
</ul>
<p><img fetchpriority="high" decoding="async" class="alignleft size-full wp-image-258" src="https://contentviewspro.com/documentation/wp-content/uploads/2015/07/add-custom-field.png" alt="add-custom-field" width="837" height="229" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2015/07/add-custom-field.png 837w, https://contentviewspro.com/documentation/wp-content/uploads/2015/07/add-custom-field-300x82.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2015/07/add-custom-field-768x210.png 768w" sizes="(max-width: 837px) 100vw, 837px" /></p>
<p>If this is the first custom field on your WordPress site, you might need to click &#8220;Enter new&#8221; link to start adding the new custom field.</p>
<h2 id="enable">Couldn&#8217;t find &#8220;Custom Fields&#8221; area</h2>
<ul>
<li>Custom fields are hidden by default, at the first time, you need to enable it:<br />
<h5> For WordPress 5.0 and later</h5>
<p>+ For older versions of WordPress, click the ellipsis icon (near the gear icon), click <strong>Options</strong> and check the <strong>Custom Fields</strong> box (under &#8220;Advanced Panels&#8221;).</p>
<p>+ For newer versions of WordPress, click the ellipsis icon (near the gear icon):<br />
<img decoding="async" width="287" height="204" class="alignnone wp-image-4827 size-full" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted.png" /></p>
<p>click <strong>Preferences:<br />
</strong><br />
<img decoding="async" width="360" height="274" class="alignnone wp-image-4828 size-full" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-1.png" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-1.png 360w, https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-1-300x228.png 300w" sizes="(max-width: 360px) 100vw, 360px" /></p>
<p>click <strong>Panels</strong> and check the <strong>Custom Fields</strong> box (under &#8220;Additional&#8221;):</p>
<p><img loading="lazy" decoding="async" width="711" height="410" class="alignnone wp-image-4829 size-full" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-2.png" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-2.png 711w, https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Pasted-2-300x173.png 300w" sizes="auto, (max-width: 711px) 100vw, 711px" /></p>
<hr>
<h5> For WordPress 4.9.9 and prior</h5>
<p>+ click on <strong>Screen Options</strong> tab at top right corner of the page:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-2596" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/CVP-Screen-options.png" alt="WordPress Screen Options" width="445" height="335" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/CVP-Screen-options.png 445w, https://contentviewspro.com/documentation/wp-content/uploads/2017/09/CVP-Screen-options-300x226.png 300w" sizes="auto, (max-width: 445px) 100vw, 445px" /></p>
<p>+ select the <strong>Custom Fields</strong> checkbox in the expanded area:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-2858" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Enable-WordPress-custom-field.png" alt="Enable WordPress custom field" width="736" height="200" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Enable-WordPress-custom-field.png 736w, https://contentviewspro.com/documentation/wp-content/uploads/2017/09/Enable-WordPress-custom-field-300x82.png 300w" sizes="auto, (max-width: 736px) 100vw, 736px" /></li>
<li>If you can&#8217;t see the <strong>Custom Fields</strong> option, the current post type might not support custom field.<br />
To add a new custom field for this post type, you can install a custom field plugin (for example: Advanced Custom Fields), it will help you to add a custom field to any post types easily.</li>
</ul>
<blockquote><p>After adding custom field, you can show custom field easily (<a href="https://contentviewspro.com/documentation/article/how-to-show-wordpress-custom-field/">read more</a>)</p></blockquote>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Link the custom field to the post URL</title>
		<link>https://contentviewspro.com/documentation/article/link-custom-field-to-post-url/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Fri, 25 Aug 2017 08:44:59 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1996</guid>

					<description><![CDATA[Content Views Pro helps you to show custom fields easily. By default, value of fields will be shown as they were added. If you want to link the shown custom field to the URL of post which contains that custom field, please add this code to file functions.php of your active theme: // Content Views &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/link-custom-field-to-post-url/"> <span class="screen-reader-text">Link the custom field to the post URL</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to <a href="https://contentviewspro.com/documentation/article/how-to-show-wordpress-custom-field/" rel="noopener noreferrer" target="_blank">show custom fields</a> easily. By default, value of fields will be shown as they were added.<br />
If you want to link the shown custom field to the URL of post which contains that custom field, please add this code to file <strong>functions.php</strong> of your active theme:</p>
<pre style="font-size:13px">
// Content Views Pro - Link custom field to post URL
add_filter( 'pt_cv_ctf_value', 'cvp_theme_ctf_link_to_post', 100, 3 );
function cvp_theme_ctf_link_to_post( $args, $key, $post ) {
	if ( $key == 'NAME_OF_FIELD' ) {
		$args = sprintf( '&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;', get_permalink( $post ), $args );
	}

	return $args;
}
</pre>
<p>(Please replace <strong>NAME_OF_FIELD</strong> with name of your custom field)</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Format a numeric custom field value</title>
		<link>https://contentviewspro.com/documentation/article/format-custom-field-number/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Mon, 31 Jul 2017 04:48:50 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1888</guid>

					<description><![CDATA[Content Views Pro helps you to show any WordPress custom fields (including ACF, Pods, Types&#8230;) easily. You may need to format a numeric custom field value (for example, show a number in price format). To do it, please add this code to file functions.php of your active WordPress theme: // Content Views Pro - format &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/format-custom-field-number/"> <span class="screen-reader-text">Format a numeric custom field value</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show any WordPress custom fields (including ACF, Pods, Types&#8230;) easily.<br />
You may need to format a numeric custom field value (for example, show a number in price format). To do it, please add this code to file <strong>functions.php</strong> of your active WordPress theme:</p>
<pre style="font-size:13px">
// Content Views Pro - format a numeric custom field value
add_filter( 'pt_cv_ctf_value', 'cvp_theme_ctf_format_value', 100, 3 );
function cvp_theme_ctf_format_value( $args, $key, $post ) {
	if ( $key == 'FIELD_NAME' ) {
		// Format the number
		$decimals	     = 0;
		$decimals_point	     = '.';
		$thousands_separator = ',';
		$formated_value	     = number_format( (float) $args, $decimals, $decimals_point, $thousands_separator );

		// Add "$" before number, add "USD" after number
		$args = sprintf( '$ %s USD', $formated_value );
	}

	return $args;
}
</pre>
<p>Please replace <strong>FIELD_NAME</strong> with name of your custom field.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Set dynamic value when filter by a custom field</title>
		<link>https://contentviewspro.com/documentation/article/set-dynamic-value-filtering-custom-field/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Tue, 20 Jun 2017 05:02:00 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1698</guid>

					<description><![CDATA[With Content Views Pro, you can set a static value to filter content by custom field easily. This document will help you to set dynamic value (from URL parameters, current author id, and so on) to filter by custom field. Here is how: Filter by Custom Field: &#8220;Field Key&#8221;: select the custom field that you &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/set-dynamic-value-filtering-custom-field/"> <span class="screen-reader-text">Set dynamic value when filter by a custom field</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>With Content Views Pro, you can set a static value to filter content by custom field easily.<br />
This document will help you to set dynamic value (from URL parameters, current author id, and so on) to filter by custom field. Here is how:</p>
<ul>
<li>Filter by Custom Field:<br />
&#8220;Field Key&#8221;: select the custom field that you want to filter<br />
&#8220;Value Type&#8221;: select Text (or another option depending on value type of selected field),<br />
&#8220;Operator To Compare&#8221;: select <code>Equal (=)</code> (or another option depending on your needs),<br />
&#8220;Value To Compare&#8221;: enter <code>1</code> (or enter actual value, please ensure value is <strong>not blank or empty</strong>).<br />
<img decoding="async" class="thumbnail" style="max-width: 100%;" src="https://contentviewspro.com/documentation/wp-content/uploads/2025/03/filter-ctf.png" alt="" /></li>
<li>then add this code to file <strong>functions.php</strong> of your active theme:
<pre style="font-size: 13px; margin-top: 10px;">// Content Views Pro - set value of custom field dynamically
add_filter( 'pt_cv_query_ctf_value', 'cvp_theme_query_ctf_dynamic_value', 100, 2 );
function cvp_theme_query_ctf_dynamic_value( $args, $key ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' &amp;&amp; $key === 'NAME_OF_CUSTOM_FIELD' ) {

		/* <span style="color: red;">Todo: replace 1 by PHP expression/function to set dynamic value for custom field</span> */
		$value = 1;

		if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination' ) ) {
			global $pt_cv_id;
			$trans_key = 'cvp_ctf_value_' . $key . $pt_cv_id;
			if ( !defined( 'PT_CV_DOING_PAGINATION' ) ) {
				set_transient( $trans_key, $value, 1 * HOUR_IN_SECONDS );
			} else {
				$value = get_transient( $trans_key );
			}
		}

		// If value is not empty (0, null, false, empty string/array)
		if ( !empty( $value ) ) {
			$args = $value;
		}
	}

	return $args;
}
</pre>
<p>and replace <strong>VIEW_ID</strong> with <a href="https://contentviewspro.com/documentation/article/what-is-id-of-a-view/">ID of your View</a>, replace <strong>NAME_OF_CUSTOM_FIELD</strong> with name of the custom field.</li>
</ul>
<hr />
<p>If you want to filter the posts that have custom field value is same as custom field value of current post, you can replace <code>$value = 1;</code> in above code with this code:</p>
<pre style="font-size: 13px; margin-top: 10px;">global $post;
$meta = get_post_meta( $post-&gt;ID );
$value = !empty( $meta[ 'NAME_OF_CUSTOM_FIELD' ][ 0 ] ) ? $meta[ 'NAME_OF_CUSTOM_FIELD' ][ 0 ] : 0;
</pre>
<p>(replace <strong>NAME_OF_CUSTOM_FIELD</strong> with name of the custom field)</p>
<p><strong>Notice</strong>: This task requires coding skill. So please ensure that you know what to do.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show custom field (core, ACF, Pods, MetaBox&#8230;) of posts in grid</title>
		<link>https://contentviewspro.com/documentation/article/how-to-show-wordpress-custom-field/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Mon, 01 May 2017 02:59:41 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1542</guid>

					<description><![CDATA[Custom field is meta-data of each WordPress post, it helps you to add extra information easily. This document will cover how to add and show WordPress custom field with Content Views Pro. If you have not added any custom field yet, please check this document (click here). To show custom field, please follow these steps: &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/how-to-show-wordpress-custom-field/"> <span class="screen-reader-text">Show custom field (core, ACF, Pods, MetaBox&#8230;) of posts in grid</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Custom field is meta-data of each WordPress post, it helps you to add extra information easily. This document will cover how to add and show WordPress custom field with Content Views Pro.</p>
<blockquote><p>If you have not added any custom field yet, please check this document (<a href="http://contentviewspro.com/documentation/article/add-new-custom-field-wordpress-post/" target="_blank" rel="noopener noreferrer">click here</a>).</p></blockquote>
<p>To show custom field, please follow these steps:</p>
<ul>
<li>Click Content Views &gt;&gt; Add New to creating new View to show custom field</li>
<li>Click <strong>Display Settings</strong> tab of the View
<p><img loading="lazy" decoding="async" width="868" height="146" class="alignnone wp-image-4983 size-full" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted.png" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted.png 868w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-300x50.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-768x129.png 768w" sizes="auto, (max-width: 868px) 100vw, 868px" /></li>
<li>In <strong>Fields Settings</strong> section, click the <strong>Show Custom Fields</strong> checkbox.<br />
In <strong>Select Fields</strong>, select the custom fields you want to show:</p>
<p><img loading="lazy" decoding="async" width="834" height="471" class="alignnone wp-image-4987 size-full" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-1.png" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-1.png 834w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-1-300x169.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/Pasted-1-768x434.png 768w" sizes="auto, (max-width: 834px) 100vw, 834px" /><br />
<em>(The options to select are the <ins>Name</ins> of the custom fields:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3637" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/custom-field-name.png" alt="name of custom field" width="861" height="203" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/05/custom-field-name.png 861w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/custom-field-name-300x71.png 300w, https://contentviewspro.com/documentation/wp-content/uploads/2017/05/custom-field-name-768x181.png 768w" sizes="auto, (max-width: 861px) 100vw, 861px" /><br />
)</em></li>
</ul>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show custom field, meta field&#8230; of the current post/page</title>
		<link>https://contentviewspro.com/documentation/article/show-custom-field-meta-field-current-post/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Thu, 09 Mar 2017 12:28:30 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1441</guid>

					<description><![CDATA[Content Views Pro helps you to show custom field, meta field… of current post in single post page with 2 steps: create a new View, select custom fields and meta fields you want to show. Especially, you might need to select the option All / Multi post types for Filter Settings > Content Type to &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-custom-field-meta-field-current-post/"> <span class="screen-reader-text">Show custom field, meta field&#8230; of the current post/page</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show custom field, meta field… of current post in single post page with 2 steps:</p>
<ol>
<li>create a new View, <a href="https://contentviewspro.com/documentation/article/how-to-show-wordpress-custom-field/">select custom fields</a> and meta fields you want to show.<br />
<br />
Especially, you might need to select the option <code>All / Multi post types</code> for Filter Settings > Content Type to match the post type correctly and automatically.<br />
<img loading="lazy" decoding="async" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/03/Show-all-post-types.png" alt="" width="636" height="165" class="alignnone size-full wp-image-4120" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/03/Show-all-post-types.png 636w, https://contentviewspro.com/documentation/wp-content/uploads/2017/03/Show-all-post-types-300x78.png 300w" sizes="auto, (max-width: 636px) 100vw, 636px" />
</li>
<li>show the View:
<ul style="margin-top:15px">
<li>To show for specific posts only, please edit these posts, then add below shortcode to text editor:
<pre style="font-size:13px">
&#91;pt_view id="VIEW_ID" post_id="GET_CURRENT"&#93;
</pre>
</li>
<li>To show for each of all posts, 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 Pro - show related posts for each post
add_filter( 'the_content', 'cvp_theme_show_info_of_current_post', 999 );
function cvp_theme_show_info_of_current_post( $content ) {
	if ( is_single() ) {
		ob_start();
		echo do_shortcode( '&#91;pt_view id="VIEW_ID" post_id="GET_CURRENT"&#93;' );
		$content .= ob_get_clean();
	}
	return $content;
}
</pre>
</li>
</ul>
<p>Please replace <strong>VIEW_ID</strong> in above code with <a href="https://contentviewspro.com/documentation/article/what-is-id-of-a-view/">ID of the View</a> in step 1.</p>
</li>
</ol>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show an image custom field as thumbnail</title>
		<link>https://contentviewspro.com/documentation/article/show-custom-field-as-thumbnail-of-post/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Wed, 01 Feb 2017 07:48:36 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1898</guid>

					<description><![CDATA[Content Views Pro version 5.5.0 and higher Since Content Views Pro version 5.5.0, you can easily show image custom field as thumbnail without coding. Here is the configuration in Display Settings &#62;&#62; Fields Settings &#62;&#62; Thumbnail of the View to show any image custom field as thumbnail: Content Views Pro version 5.4.1 and prior For &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-custom-field-as-thumbnail-of-post/"> <span class="screen-reader-text">Show an image custom field as thumbnail</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<h2>Content Views Pro version 5.5.0 and higher</h2>
<p>Since Content Views Pro version 5.5.0, you can easily show image custom field as thumbnail without coding.</p>
<p>Here is the configuration in Display Settings &gt;&gt; Fields Settings &gt;&gt; Thumbnail of the View to show any image custom field as thumbnail:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3562" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/02/Content-Views-Pro-Show-image-custom-field-as-thumbnail.png" alt="" width="581" height="138" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/02/Content-Views-Pro-Show-image-custom-field-as-thumbnail.png 581w, https://contentviewspro.com/documentation/wp-content/uploads/2017/02/Content-Views-Pro-Show-image-custom-field-as-thumbnail-300x71.png 300w" sizes="auto, (max-width: 581px) 100vw, 581px" /></p>
<h2>Content Views Pro version 5.4.1 and prior</h2>
<p>For previous Pro versions, to show the custom field as thumbnail, please follow steps below:</p>
<ul>
<li>In the View where you want to show the custom field as thumbnail, select the <strong>Show Thumbnail</strong> checkbox in Display Settings &gt;&gt; Fields settings.</li>
<li>Under Display Settings &gt;&gt; Fields settings &gt;&gt; Thumbnail &gt;&gt; Substitute, please configure as below:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-2776" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/02/CVP-show-custom-field-as-thumbnail.png" alt="CVP - show custom field as thumbnail" width="540" height="145" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/02/CVP-show-custom-field-as-thumbnail.png 540w, https://contentviewspro.com/documentation/wp-content/uploads/2017/02/CVP-show-custom-field-as-thumbnail-300x81.png 300w" sizes="auto, (max-width: 540px) 100vw, 540px" /></li>
<li id="code">Add this code to file <strong>functions.php</strong> of your active theme:
<pre style="font-size: 13px;">
// Content Views Pro - Use custom field as thumbnail
add_filter( 'pt_cv_field_content_excerpt', 'cvp_theme_custom_field_as_thumbnail', 999, 3 );
function cvp_theme_custom_field_as_thumbnail( $args, $fargs, $post ) {
	if ( empty( $fargs ) ) {
		$custom_field = 'CUSTOM_FIELD';

		$fval = null;
		if ( class_exists( 'CVP_CTF' ) ) {
			$ctf  = new CVP_CTF( $custom_field, $post, true, '' );
			$fval = isset( $ctf->field_value ) ? $ctf->field_value : $fval;
		}

		if ( empty( $fval ) ) {
			$meta = get_post_meta( $post->ID );
			$fval = !empty( $meta[ $custom_field ][ 0 ] ) ? $meta[ $custom_field ][ 0 ] : $fval;
		}

		$args = $fval ? sprintf( "&lt;img src='%s'&gt;", esc_url( $fval ) ) : $args;
	}

	return $args;
}
</pre>
<p>(replace <strong>CUSTOM_FIELD</strong> with name/key of your custom field).</li>
</ul>
<p style="display: none;">Notice: If you created custom field with Toolset plugin, you may need to add prefix <code>wpcf-</code>. For example, you created a custom field <code>post-image</code> with Toolset plugin, then the value of <strong>CUSTOM_FIELD</strong> should be <code>wpcf-post-image</code>.</p>
<p>Thank you,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Set MySQL date format when sort by a custom field</title>
		<link>https://contentviewspro.com/documentation/article/specify-date-format-for-sorting-custom-field/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Wed, 14 Dec 2016 09:50:53 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1107</guid>

					<description><![CDATA[If the value (stored in database) of your date custom field is not in kind of Year Month Day format (for example: 1970-01-01 or 1970/01/01), WordPress may not able to sort by that field correctly. To make it work correctly, please specify MySQL date format of the value (stored in database) of your custom field. &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/specify-date-format-for-sorting-custom-field/"> <span class="screen-reader-text">Set MySQL date format when sort by a custom field</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>If the value (stored in database) of your date custom field is not in kind of <strong>Year Month Day</strong> format (for example: 1970-01-01 or 1970/01/01), WordPress may not able to sort by that field correctly.</p>
<p>To make it work correctly, please specify MySQL date format of the value (stored in database) of your custom field.</p>
<p>Here are some common formats:<br />
<code>%m/%d/%Y</code> (for m/d/Y)<br />
<code>%m-%d-%Y</code> (for m-d-Y)<br />
<code>%d/%m/%Y</code> (for d/m/Y)<br />
<code>%d-%m-%Y</code> (for d-m-Y)</p>
<p>Here are some examples:<br />
date value is <strong>Jan 01 1970</strong> =&gt; date format is <code>%b %d %Y</code><br />
date value is <strong>1st/01/1970</strong> =&gt; date format is <code>%D/%m/%Y</code><br />
date value is <strong>2020-10-20</strong> =&gt; date format is <code>%Y-%m-%d</code><br />
date value is <strong>1543310966</strong> =&gt; date format is <code>_UNIX_TIMESTAMP_</code> (this custom format is available since Content Views Pro version 5.4.0)</p>
<p>Please check below table to get correct format for each part in your date value.</p>
<table class="informaltable" border="1">
<colgroup>
<col />
<col /> </colgroup>
<thead>
<tr>
<th scope="col">Value</th>
<th scope="col" width="160">Format</th>
</tr>
</thead>
<tbody>
<tr>
<td>Unix timestamp ( a long number string, for example: 1543310966 )</td>
<td scope="row"><code class="literal">_UNIX_TIMESTAMP_</code></td>
</tr>
<tr>
<td>Abbreviated weekday name ( <code class="literal">Sun</code>.. <code class="literal">Sat</code>)</td>
<td scope="row"><code class="literal">%a</code></td>
</tr>
<tr>
<td>Abbreviated month name ( <code class="literal">Jan</code>.. <code class="literal">Dec</code>)</td>
<td scope="row"><code class="literal">%b</code></td>
</tr>
<tr>
<td>Month, numeric ( <code class="literal">0</code>.. <code class="literal">12</code>)</td>
<td scope="row"><code class="literal">%c</code></td>
</tr>
<tr>
<td>Day of the month with English suffix ( <code class="literal">0th</code>, <code class="literal">1st</code>, <code class="literal">2nd</code>, <code class="literal">3rd</code>, …)</td>
<td scope="row"><code class="literal">%D</code></td>
</tr>
<tr>
<td>Day of the month, numeric ( <code class="literal">00</code>.. <code class="literal">31</code>)</td>
<td scope="row"><code class="literal">%d</code></td>
</tr>
<tr>
<td>Day of the month, numeric ( <code class="literal">0</code>.. <code class="literal">31</code>)</td>
<td scope="row"><code class="literal">%e</code></td>
</tr>
<tr>
<td>Microseconds ( <code class="literal">000000</code>.. <code class="literal">999999</code>)</td>
<td scope="row"><code class="literal">%f</code></td>
</tr>
<tr>
<td>Hour ( <code class="literal">00</code>.. <code class="literal">23</code>)</td>
<td scope="row"><code class="literal">%H</code></td>
</tr>
<tr>
<td>Hour ( <code class="literal">01</code>.. <code class="literal">12</code>)</td>
<td scope="row"><code class="literal">%h</code></td>
</tr>
<tr>
<td>Hour ( <code class="literal">01</code>.. <code class="literal">12</code>)</td>
<td scope="row"><code class="literal">%I</code></td>
</tr>
<tr>
<td>Minutes, numeric ( <code class="literal">00</code>.. <code class="literal">59</code>)</td>
<td scope="row"><code class="literal">%i</code></td>
</tr>
<tr>
<td>Day of year ( <code class="literal">001</code>.. <code class="literal">366</code>)</td>
<td scope="row"><code class="literal">%j</code></td>
</tr>
<tr>
<td>Hour ( <code class="literal">0</code>.. <code class="literal">23</code>)</td>
<td scope="row"><code class="literal">%k</code></td>
</tr>
<tr>
<td>Hour ( <code class="literal">1</code>.. <code class="literal">12</code>)</td>
<td scope="row"><code class="literal">%l</code></td>
</tr>
<tr>
<td>Month name ( <code class="literal">January</code>.. <code class="literal">December</code>)</td>
<td scope="row"><code class="literal">%M</code></td>
</tr>
<tr>
<td>Month, numeric ( <code class="literal">00</code>.. <code class="literal">12</code>)</td>
<td scope="row"><code class="literal">%m</code></td>
</tr>
<tr>
<td><code class="literal">AM</code> or <code class="literal">PM</code></td>
<td scope="row"><code class="literal">%p</code></td>
</tr>
<tr>
<td>Time, 12-hour ( <code class="literal">hh:mm:ss</code> followed by <code class="literal">AM</code> or <code class="literal">PM</code>)</td>
<td scope="row"><code class="literal">%r</code></td>
</tr>
<tr>
<td>Seconds ( <code class="literal">00</code>.. <code class="literal">59</code>)</td>
<td scope="row"><code class="literal">%S</code></td>
</tr>
<tr>
<td>Seconds ( <code class="literal">00</code>.. <code class="literal">59</code>)</td>
<td scope="row"><code class="literal">%s</code></td>
</tr>
<tr>
<td>Time, 24-hour ( <code class="literal">hh:mm:ss</code>)</td>
<td scope="row"><code class="literal">%T</code></td>
</tr>
<tr>
<td>Week ( <code class="literal">00</code>.. <code class="literal">53</code>), where Sunday is the first day of the week; <code class="literal">WEEK()</code> mode 0</td>
<td scope="row"><code class="literal">%U</code></td>
</tr>
<tr>
<td>Week ( <code class="literal">00</code>.. <code class="literal">53</code>), where Monday is the first day of the week; <code class="literal">WEEK()</code> mode 1</td>
<td scope="row"><code class="literal">%u</code></td>
</tr>
<tr>
<td>Week ( <code class="literal">01</code>.. <code class="literal">53</code>), where Sunday is the first day of the week; <code class="literal">WEEK()</code> mode 2; used with <code class="literal">%X</code></td>
<td scope="row"><code class="literal">%V</code></td>
</tr>
<tr>
<td>Week ( <code class="literal">01</code>.. <code class="literal">53</code>), where Monday is the first day of the week; <code class="literal">WEEK()</code> mode 3; used with <code class="literal">%x</code></td>
<td scope="row"><code class="literal">%v</code></td>
</tr>
<tr>
<td>Weekday name ( <code class="literal">Sunday</code>.. <code class="literal">Saturday</code>)</td>
<td scope="row"><code class="literal">%W</code></td>
</tr>
<tr>
<td>Day of the week ( <code class="literal">0</code>=Sunday.. <code class="literal">6</code>=Saturday)</td>
<td scope="row"><code class="literal">%w</code></td>
</tr>
<tr>
<td>Year for the week where Sunday is the first day of the week, numeric, four digits; used with <code class="literal">%V</code></td>
<td scope="row"><code class="literal">%X</code></td>
</tr>
<tr>
<td>Year for the week, where Monday is the first day of the week, numeric, four digits; used with <code class="literal">%v</code></td>
<td scope="row"><code class="literal">%x</code></td>
</tr>
<tr>
<td>Year, numeric, four digits</td>
<td scope="row"><code class="literal">%Y</code></td>
</tr>
<tr>
<td>Year, numeric (two digits)</td>
<td scope="row"><code class="literal">%y</code></td>
</tr>
<tr>
<td>A literal <code class="literal">%</code> character</td>
<td scope="row"><code class="literal">%%</code></td>
</tr>
<tr>
<td><em class="replaceable"><code>x</code></em>, for any <span class="quote">“ <span class="quote"><em class="replaceable"><code>x</code></em></span>”</span> not listed above</td>
<td scope="row"><code class="literal">% <em class="replaceable"><code>x</code></em><br />
</code></td>
</tr>
</tbody>
</table>
<p>Source: https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add text, icon, HTML&#8230; before/after the value of Custom field</title>
		<link>https://contentviewspro.com/documentation/article/custom-field-prepend-prefix-icon-text/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Tue, 12 Jul 2016 08:43:09 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=878</guid>

					<description><![CDATA[Content Views Pro helps you to show name, value of custom field easily. To add custom icon, text, etc. before and after the field&#8217;s value, you can use one of 2 following solutions: Add simple icon, text Please add this code to Custom CSS field in Content Views >> Settings page: .pt-cv-custom-fields[class*="FIELD_KEY"] { display: block &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/custom-field-prepend-prefix-icon-text/"> <span class="screen-reader-text">Add text, icon, HTML&#8230; before/after the value of Custom field</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show name, value of custom field easily.<br />
To add custom icon, text, etc. before and after the field&#8217;s value, you can use one of 2 following solutions:</p>
<h2>Add simple icon, text</h2>
<p>Please add this code to <strong>Custom CSS</strong> field in Content Views >> Settings page:</p>
<pre style="font-size: 13px;">.pt-cv-custom-fields[class*="FIELD_KEY"] {
    display: block !important;
}
.pt-cv-custom-fields[class*="FIELD_KEY"]:before {
    display: block;
    content: 'Your text here';
}
.pt-cv-custom-fields[class*="FIELD_KEY"]:after {
    display: block;
    content: 'Your text here';
}
</pre>
<p>(replace FIELD_KEY with the key of your custom field)</p>
<p>This is a sample to show a FontAwesome icon before the value:</p>
<pre style="font-size: 13px;">
.pt-cv-custom-fields[class*="FIELD_KEY"]:before {
    display: block;
    font-family: "Font Awesome 5 Brands";
    content: "\f082"; /* replace f082 with Unicode of the icon you want to use */
}
</pre>
<p>(to use FontAwesome, you need add this code to the header.php file of the theme:</p>
<pre style="font-size: 13px;">
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;//use.fontawesome.com/releases/v5.7.2/css/all.css&quot;&gt;
</pre>
<p>)</p>
<h2 id="complex">Add complex HTML</h2>
<p>Please add this code to file <strong>functions.php</strong> in the directory of your active theme:</p>
<pre style="font-size: 13px;">// Content Views Pro - Prepend prefix for custom field
add_filter( 'pt_cv_ctf_value', 'cvp_theme_ctf_value_prepend', 100, 3 );
function cvp_theme_ctf_value_prepend( $value, $key, $post ) {

	if ( $key === 'FIELD_KEY_1' ) {
		$value = 'YOUR CUSTOM HTML' . $value . 'YOUR CUSTOM HTML';
	}

	if ( $key === 'FIELD_KEY_2' ) {
		$value = 'YOUR CUSTOM HTML' . $value . 'YOUR CUSTOM HTML';
	}

	// and so on
	
	return $value;
}
</pre>
<p>For both cases, please replace <strong>FIELD_KEY_1, FIELD_KEY_2</strong> with name of your custom fields.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
