{"id":1829,"date":"2017-07-18T03:34:06","date_gmt":"2017-07-18T03:34:06","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=1829"},"modified":"2023-12-28T09:15:58","modified_gmt":"2023-12-28T09:15:58","password":"","slug":"show-new-icon-recent-posts-title","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/show-new-icon-recent-posts-title\/","title":{"rendered":"Add &#8220;NEW&#8221; icon after recent post title"},"content":{"rendered":"<p>You might want to show a &#8220;NEW&#8221; icon after your latest posts&#8217; title.<br \/>\nPlease add this code to file <strong>functions.php<\/strong> of your active theme:<\/p>\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - Show custom icon in title\nadd_filter( 'pt_cv_field_title_result', 'cvp_theme_title_new_icon', 100, 3 );\nfunction cvp_theme_title_new_icon( $title, $fargs, $post ) {\n\t$hours\t = 24; \/* TODO: change this value to number of hours to calculate *\/\n\t$diff\t = time() - mysql2date( 'U', $post-&gt;post_date );\n\n\tif ( $hours * 60 * 60 &gt; $diff ) {\t\t\n\t\t\/\/ 1. To show a &quot;New&quot; icon\/image, remove the 2. below\n\t\t$title = $title . &quot;&lt;img src='IMAGE_URL_HERE' \/&gt;&quot;;\n\t\t\n\t\t\/\/ 2. To show a &quot;New&quot; text, remove the 1. above\n\t\t$title = $title . &quot;&lt;span style='padding:2px 8px;color:#fff;background:red;margin-left:5px;'&gt;New&lt;\/span&gt;&quot;;\n\t}\n\n\treturn $title;\n}\n<\/pre>\n<p>Thank you,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might want to show a &#8220;NEW&#8221; icon after your latest posts&#8217; title. Please add this code to file functions.php of your active theme: \/\/ Content Views Pro &#8211; Show custom icon in title add_filter( &#8216;pt_cv_field_title_result&#8217;, &#8216;cvp_theme_title_new_icon&#8217;, 100, 3 ); function cvp_theme_title_new_icon( $title, $fargs, $post ) { $hours = 24; \/* TODO: change this value &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/show-new-icon-recent-posts-title\/\"> <span class=\"screen-reader-text\">Add &#8220;NEW&#8221; icon after recent post title<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[9],"doc_tag":[21,15],"class_list":["post-1829","docs","type-docs","status-publish","hentry","doc_category-how-to","doc_tag-custom-code","doc_tag-post-title"],"year_month":"2026-09","word_count":138,"total_views":"1","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"CVP","author_nicename":"cvp","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/cvp\/"},"doc_category_info":[{"term_name":"How To","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/how-to\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"},{"term_name":"post title","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/post-title\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=1829"}],"version-history":[{"count":1,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1829\/revisions"}],"predecessor-version":[{"id":5512,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1829\/revisions\/5512"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=1829"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=1829"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=1829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}