<?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>Advanced Modification &#8211; Content Views Pro</title>
	<atom:link href="https://contentviewspro.com/documentation/cats/advanced-modification/feed/" rel="self" type="application/rss+xml" />
	<link>https://contentviewspro.com/documentation</link>
	<description>Most Popular Filter &#38; Grid Plugin For WordPress</description>
	<lastBuildDate>Tue, 11 Mar 2025 09:06:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Add custom text, HTML at the end of post</title>
		<link>https://contentviewspro.com/documentation/article/add-custom-text-html-end-post/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Mon, 06 Mar 2017 03:36:39 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1419</guid>

					<description><![CDATA[Sometimes you want to show custom text or HTML at the end of each post in View, you can do it easily by adding this code to file functions.php of your active theme: // Content Views Pro - Display custom HTML at end of post add_action( 'pt_cv_item_extra_html', 'cvp_theme_item_extra_html' ); function cvp_theme_item_extra_html( $post_id ) { global &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/add-custom-text-html-end-post/"> <span class="screen-reader-text">Add custom text, HTML at the end of post</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Sometimes you want to show custom text or HTML at the end of each post in View, you can do it easily by adding this code to file <strong>functions.php</strong> of your active theme:</p>
<pre style="font-size:13px">// Content Views Pro - Display custom HTML at end of post
add_action( 'pt_cv_item_extra_html', 'cvp_theme_item_extra_html' );
function cvp_theme_item_extra_html( $post_id ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' ) {
		ob_start();

		// Put the text, HTML or PHP code here

		echo ob_get_clean();
	} // <strong>Ensure to put } BELOW the line of ob_get_clean()</strong>
}</pre>
<p><em>(Please replace <strong>VIEW_ID</strong> with ID of your View)</em></p>
<p><strong>Notice</strong>: This task requires your coding skills about PHP, HTML.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Customize the HTML template/structure of each post in the grid layout</title>
		<link>https://contentviewspro.com/documentation/article/customize-html-structure-post/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Tue, 13 Jun 2017 16:06:40 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=1639</guid>

					<description><![CDATA[Each layout of Content Views Pro has its own way to display post fields (thumbnail, title, content&#8230;). Normally, you can change the display order of fields by drag &#038; drop checkboxes under Display Settings >> Fields settings easily. But if you want to create your own HTML output of post in View, you can add &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/customize-html-structure-post/"> <span class="screen-reader-text">Customize the HTML template/structure of each post in the grid layout</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Each layout of Content Views Pro has its own way to display post fields (thumbnail, title, content&#8230;). Normally, you can change the display order of fields by drag &#038; drop checkboxes under <strong>Display Settings >> Fields settings</strong> easily.</p>
<p>But if you want to create your own HTML output of post in View, you can add this code to file <strong>functions.php</strong> of your active theme:</p>
<pre style="font-size:13px">
// Content Views Pro - Very custom HTML output for each post
add_filter( 'pt_cv_view_type_custom_output', 'cvp_theme_view_type_custom_output', 100, 3 );
/**
 * Customize HTML output of each post
 *
 * @param string $args       Current HTML output for a post
 * @param array $fields_html Array of fields (title, thumbnail, content...) and their HTML output
 * @param object $post       The current post object
 * @return string
 */
function cvp_theme_view_type_custom_output( $args, $fields_html, $post ) {
	// Do this for only specific Views
	global $pt_cv_id;
	if ( in_array( $pt_cv_id, array( 'VIEW_1', 'VIEW_2', 'VIEW_3' ) ) ) {
		ob_start();
		?&gt;
		&lt;!-- Your custom HTML here. You can access:
		$fields_html[ 'thumbnail' ]
		$fields_html[ 'title' ]
		$fields_html[ 'content' ]
		$fields_html[ 'meta-fields' ]
		$fields_html[ 'custom-fields' ]
		$fields_html[ 'others-wrap' ] (when enable "Do not wrap text around image")
		--&gt;
		&lt;?php
		$args = ob_get_clean();
	} // <strong>Ensure to put } BELOW the line of ob_get_clean()</strong>

	return $args;
}
</pre>
<p>Please replace <strong>VIEW_1, VIEW_2, VIEW_3</strong> with IDs of your Views. And you can add/remove Views as you want.</p>
<p><strong>Notice</strong>: This task requires your coding skills about PHP, HTML.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add custom text, HTML before/after the Title, Thumbnail, Content, Meta Fields&#8230;</title>
		<link>https://contentviewspro.com/documentation/article/add-custom-text-html-etc-title-thumbnail-content-meta-fields-custom-fields/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Fri, 24 Nov 2017 03:35:54 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=2603</guid>

					<description><![CDATA[Content Views Pro helps you to show the Title, Thumbnail image, Content, Meta Fields, Custom Fields of any WordPress posts easily. You might want to show dynamic, custom info before (or after) one of these fields. To do that, please add this code to file functions.php in the theme&#8217;s folder: /** * Add extra info &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/add-custom-text-html-etc-title-thumbnail-content-meta-fields-custom-fields/"> <span class="screen-reader-text">Add custom text, HTML before/after the Title, Thumbnail, Content, Meta Fields&#8230;</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views Pro helps you to show the Title, Thumbnail image, Content, Meta Fields, Custom Fields of any WordPress posts easily.<br />
You might want to show dynamic, custom info before (or after) one of these fields. To do that, please add this code to file <strong>functions.php</strong> in the theme&#8217;s folder:</p>
<pre style="font-size:13px">
/**
 * Add extra info before/after the field.
 * <strong>@TODO:</strong> Remove any line below if you don't need
 */
add_filter( 'pt_cv_item_title', 'cvp_theme_custom_content_to_field', 10, 2 );
add_filter( 'pt_cv_item_thumbnail', 'cvp_theme_custom_content_to_field', 10, 2 );
add_filter( 'pt_cv_item_content', 'cvp_theme_custom_content_to_field', 10, 2 );
add_filter( 'pt_cv_item_meta-fields', 'cvp_theme_custom_content_to_field', 10, 2 );
add_filter( 'pt_cv_item_custom-fields', 'cvp_theme_custom_content_to_field', 10, 2 );

/**
 * The function to add extra content to before (or after) above field
 * @param string $html
 * @param object $post
 * @return string
 */
function cvp_theme_custom_content_to_field( $html, $post ) {

	$position = 'after'; // or 'before' the field

	ob_start();
	//<strong> @TODO:</strong> Add text, HTML, PHP code (access current post ID by <strong>$post-&gt;ID</strong>)

	$extra = ob_get_clean();
	if ( $position === 'after' ) {
		$html .= $extra;
	} else {
		$html = $extra . $html;
	}

	return $html;
}
</pre>
<p><strong>Notice 1</strong>: This task requires your coding skills about PHP, HTML.</p>
<p><strong>Notice 2</strong>: If you want to apply above code to specific view only, below this line:</p>
<pre style="font-size:13px">
function cvp_theme_custom_content_to_field( $html, $post ) {
</pre>
<p>please add this line:</p>
<pre style="font-size:13px">
global $pt_cv_id; if ( $pt_cv_id !== 'VIEW_ID' ) { return $html; }
</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>.</p>
<p>Best regards,</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>
		<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>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 fetchpriority="high" 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>Show the structured data (schema markup) of the WordPress posts list</title>
		<link>https://contentviewspro.com/documentation/article/show-structured-data-wordpress-posts-list-view/</link>
		
		<dc:creator><![CDATA[CVP]]></dc:creator>
		<pubDate>Tue, 02 Jan 2018 05:20:22 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=2704</guid>

					<description><![CDATA[Structured data is a standardized format for providing information about a page and classifying the page content; for example, on a recipe page, what are the ingredients, the cooking time and temperature, the calories, and so on. You can read more about it here. This document includes solution to display structured data of the WordPress &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-structured-data-wordpress-posts-list-view/"> <span class="screen-reader-text">Show the structured data (schema markup) of the WordPress posts list</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Structured data is a standardized format for providing information about a page and classifying the page content; for example, on a recipe page, what are the ingredients, the cooking time and temperature, the calories, and so on.<br />
You can <a href="https://developers.google.com/search/docs/guides/intro-structured-data" rel="noopener noreferrer" target="_blank">read more about it here</a>.</p>
<p>This document includes solution to display structured data of the WordPress posts list by Content Views (and Content Views Pro) in JSON-LD format.<br />
This data has a short description of each item in the list, and each description points to a separate details page that is focused entirely on one item, for example:</p>
<p><img decoding="async" src="https://contentviewspro.com/documentation/wp-content/uploads/2018/01/structured-data.png" alt="structured-data" width="410" height="432" class="alignnone size-full wp-image-2707" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2018/01/structured-data.png 410w, https://contentviewspro.com/documentation/wp-content/uploads/2018/01/structured-data-285x300.png 285w" sizes="(max-width: 410px) 100vw, 410px" /></p>
<p>To generate that summary structured data, please add this code to file <strong>functions.php</strong> in the theme&#8217;s folder:</p>
<pre style="font-size:13px">
// Content Views - show structured data of the posts list
add_action( 'wp_footer', 'cvp_theme_show_structured_data' );
function cvp_theme_show_structured_data() {
	if ( !empty( $GLOBALS[ 'cv_posts' ] ) ) {
		$list = array();
		foreach ( $GLOBALS[ 'cv_posts' ] as $idx =&gt; $post ) {
			$list[] = array(
				&quot;@type&quot;		 =&gt; &quot;ListItem&quot;,
				&quot;position&quot;	 =&gt; $idx + 1,
				&quot;url&quot;		 =&gt; get_permalink( $post )
			);
		}

		echo '&lt;script type=&quot;application/ld+json&quot;&gt;{&quot;@context&quot;:&quot;http://schema.org&quot;, &quot;@type&quot;:&quot;ItemList&quot;, &quot;itemListElement&quot;:' . json_encode( $list, JSON_UNESCAPED_SLASHES ) . '}&lt;/script&gt;';
	}
}
</pre>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Show the most popular WordPress posts</title>
		<link>https://contentviewspro.com/documentation/article/show-popular-wordpress-posts/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Mon, 23 Oct 2017 09:11:12 +0000</pubDate>
				<guid isPermaLink="false">http://docs.contentviewspro.com/?p=2445</guid>

					<description><![CDATA[This feature is only available in the Pro version. As a website owner, you might want to display the most popular WordPress posts in a beautiful layout. Most popular posts have most number of visits. 1. Count number of visits WordPress doesn’t have a built-in feature to count the number of visits for each post. &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/show-popular-wordpress-posts/"> <span class="screen-reader-text">Show the most popular WordPress posts</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<blockquote><p>This feature is only available in the <a href="https://www.contentviewspro.com/#buynow" rel="noopener noreferrer" target="_blank">Pro version</a>.</p></blockquote>
<p>As a website owner, you might want to display the most popular WordPress posts in a beautiful layout. Most popular posts have most number of visits.</p>
<h2>1. Count number of visits</h2>
<p>WordPress doesn’t have a built-in feature to count the number of visits for each post. You can choose one of two custom ways below to count visits of posts:</p>
<ul>
<li>Use another plugin<br />
There are some WordPress plugins were created to implement this feature, one of them is <a href="https://wordpress.org/plugins/wp-postviews/" rel="nofollow noopener noreferrer" target="_blank">WP-PostViews</a>. Please install &#038; activate that plugin.</li>
<li>Use custom coding<br />
In case you want to make it work without using extra plugin, 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 noopener noreferrer" target="_blank">Code Snippets</a> then add this code to <a href="https://ps.w.org/code-snippets/assets/screenshot-2.png" rel="nofollow noopener noreferrer" target="_blank">the &#8220;Code&#8221; textarea</a>):</p>
<pre style="font-size:13px">
/** Content Views Pro - Enqueue script to count visits, support cache plugin */
add_action( 'wp_enqueue_scripts', 'cv_theme_count_pviews_js', PHP_INT_MAX );
function cv_theme_count_pviews_js() {
	if ( !is_singular() ) {
		return;
	}

	if ( !wp_script_is( 'jquery', 'done' ) ) {
		wp_enqueue_script( 'jquery' );
	}

	// Must use "jquery-migrate"
	wp_add_inline_script( 'jquery-migrate', 'jQuery(document).ready(function(){	jQuery.ajax({type:"GET",url:"' . admin_url( 'admin-ajax.php' ) . '",data:"post_id=' . $GLOBALS[ 'post' ]->ID . '&action=cv_count_pviews",cache:0});});' );
}

/** Content Views Pro - Count visits */
add_action( 'wp_ajax_cv_count_pviews', 'cv_theme_count_pviews_php' );
add_action( 'wp_ajax_nopriv_cv_count_pviews', 'cv_theme_count_pviews_php' );
function cv_theme_count_pviews_php() {
	if ( !isset( $_GET[ 'post_id' ] ) )
		return;

	$post_id = intval( $_GET[ 'post_id' ] );
	if ( $post_id > 0 ) {
		update_post_meta( $post_id, 'views', (int) get_post_meta( $post_id, 'views', true ) + 1 );
		exit();
	}
}

/** Content Views Pro - add default visit count 1 to all posts */
add_action( 'admin_head', 'cvp_theme_add_default_visit_count' );
function cvp_theme_add_default_visit_count() {
	if ( !get_option( 'cvp_theme_add_visit_count' ) ) {
		global $wpdb;
		$wpdb->query( "INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value)
  SELECT ID, 'views', 1
  FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type = 'post' AND {$wpdb->posts}.post_status = 'publish'" );

		add_option( 'cvp_theme_add_visit_count', 1, '', 'no' );
	}
}
</pre>
</li>
</ul>
<h2>2. Create a View to show popular posts</h2>
<p>After finishing above, here are some easy steps to show most popular WordPress posts with Content Views Pro:</p>
<ul>
<li>Open your homepage (or any another post or page) to start counting</li>
<li>In Admin area, click Content Views > Add New to start.</li>
<li>Select the <strong>Sort by</strong> option in the Filter Settings tab, Advance section of the View</li>
<li>In the &#8220;Sort by&#8221; group, click <strong>Add New</strong> button, then select options as below image:<br />
&nbsp;<br />
<img decoding="async" src="https://contentviewspro.com/documentation/wp-content/uploads/2017/10/CVP-show-most-popular-posts.png" alt="CVP - show most popular posts" width="451" height="396" class="alignnone size-full wp-image-2448" srcset="https://contentviewspro.com/documentation/wp-content/uploads/2017/10/CVP-show-most-popular-posts.png 451w, https://contentviewspro.com/documentation/wp-content/uploads/2017/10/CVP-show-most-popular-posts-300x263.png 300w" sizes="(max-width: 451px) 100vw, 451px" /></li>
</ul>
<p>Now you can add that View to where you want to show the most popular posts.</p>
<blockquote><p>Notice: At the beginning, the View might return no posts. Because of there are no posts have the <code>views</code> custom field. When someone visits your posts, the <code>views</code> custom field will be created and updated, and you will start seeing the popular posts.</p></blockquote>
<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 loading="lazy" 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="auto, (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>Pagination &#8211; trigger custom Javascript action after clicking a page number</title>
		<link>https://contentviewspro.com/documentation/article/pagination-trigger-custom-javascript-action-clicking-pagination-number/</link>
		
		<dc:creator><![CDATA[admin1]]></dc:creator>
		<pubDate>Wed, 11 Apr 2018 05:18:15 +0000</pubDate>
				<guid isPermaLink="false">https://docs.contentviewspro.com/?p=3033</guid>

					<description><![CDATA[Content Views and Content Views Pro helps you to show posts, pages, etc. with pagination easily. To trigger custom Javascript action after clicking a pagination number, please use this Javascript code: /*Pagination – trigger custom Javascript action after clicking*/ $('body').on('pt-cv-pagination-finished pt-cv-pagination-finished-simple', function(e, pages_holder, $loaded_content) { // add your JS code here }); It works with &#8230;<p class="read-more"> <a class="" href="https://contentviewspro.com/documentation/article/pagination-trigger-custom-javascript-action-clicking-pagination-number/"> <span class="screen-reader-text">Pagination &#8211; trigger custom Javascript action after clicking a page number</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>Content Views and Content Views Pro helps you to show posts, pages, etc. with pagination easily.</p>
<p>To trigger custom Javascript action after clicking a pagination number, please use this Javascript code:</p>
<pre style="font-size:13px">
/*Pagination – trigger custom Javascript action after clicking*/
$('body').on('pt-cv-pagination-finished pt-cv-pagination-finished-simple', function(e, pages_holder, $loaded_content) {
    // add your JS code here
});
</pre>
<p>It works with Ajax load-more and infinite scrolling pagination too. Your event will be triggered after the new page finishes loading.</p>
<p>Best regards,</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
