{"id":1635,"date":"2017-06-12T07:22:55","date_gmt":"2017-06-12T07:22:55","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=1635"},"modified":"2017-06-12T07:22:55","modified_gmt":"2017-06-12T07:22:55","password":"","slug":"customize-icon-for-each-post-category-tag-taxonomy-term","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/customize-icon-for-each-post-category-tag-taxonomy-term\/","title":{"rendered":"Customize icon for each post category, tag, taxonomy term"},"content":{"rendered":"<p>With Content Views Pro, you can show the icon before categories list of post.<br \/>\nBut if you want to use custom icon for each category, or tag&#8230; Please add this code to file <strong>functions.php<\/strong> of your active theme:<\/p>\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - customize icon of taxonomy\nadd_filter( 'pt_cv_post_term_html', 'cvp_theme_custom_tax_icon', 10, 2 );\nfunction cvp_theme_custom_tax_icon( $args, $term ) {\n\t$icon = '';\n\tif ( $term-&gt;slug === 'blog' ) {\n\t\t$icon = 'icon_html_here';\n\t}\n\tif ( $term-&gt;slug === 'videos' ) {\n\t\t$icon = 'icon_html_here';\n\t}\n\n\t$href\t\t = esc_url( get_term_link( $term, $term-&gt;taxonomy ) );\n\t$term_name\t = esc_attr( $term-&gt;name );\n\t$class\t\t = esc_attr( PT_CV_PREFIX . 'tax-' . $term-&gt;slug );\n\t$args\t\t = &quot;&lt;a href='$href' title='$term_name' class='$class'&gt;{$icon}{$term-&gt;name}&lt;\/a&gt;&quot;;\n\n\treturn $args;\n}\n<\/pre>\n<p>Please replace <strong>blog, videos<\/strong> with slugs of your categories, replace <strong>icon_html_here<\/strong> with an image, or span HTML&#8230;<\/p>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With Content Views Pro, you can show the icon before categories list of post. But if you want to use custom icon for each category, or tag&#8230; Please add this code to file functions.php of your active theme: \/\/ Content Views Pro &#8211; customize icon of taxonomy add_filter( &#8216;pt_cv_post_term_html&#8217;, &#8216;cvp_theme_custom_tax_icon&#8217;, 10, 2 ); function cvp_theme_custom_tax_icon( &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/customize-icon-for-each-post-category-tag-taxonomy-term\/\"> <span class=\"screen-reader-text\">Customize icon for each post category, tag, taxonomy term<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"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":[25],"doc_tag":[17,21],"class_list":["post-1635","docs","type-docs","status-publish","hentry","doc_category-adjustment","doc_tag-category-tag-taxonomy","doc_tag-custom-code"],"year_month":"2026-09","word_count":160,"total_views":"1","reactions":{"happy":"0","normal":"1","sad":"1"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Adjustment","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/adjustment\/"}],"doc_tag_info":[{"term_name":"category tag taxonomy","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/category-tag-taxonomy\/"},{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1635","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=1635"}],"version-history":[{"count":0,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/1635\/revisions"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=1635"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=1635"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=1635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}