{"id":1966550,"date":"2025-08-30T04:37:37","date_gmt":"2025-08-30T08:37:37","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?p=1966550"},"modified":"2025-08-30T04:37:37","modified_gmt":"2025-08-30T08:37:37","slug":"displaying-event-tags-in-the-events-calendar-list-view","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/displaying-event-tags-in-the-events-calendar-list-view\/","title":{"rendered":"Displaying Event Tags in The Events Calendar List View"},"content":{"rendered":"\n<p>If you use standard WordPress tags to categorize your events, you might want to display them directly on The Events Calendar&#8217;s list view. This allows visitors to see an event&#8217;s topics at a glance and click to find related events.<\/p>\n\n\n\n<p>This guide provides a single code snippet that automates the entire process. It will:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Automatically create the necessary template override file in your theme&#8217;s folder.<\/li>\n\n\n\n<li>Add the code required to display clickable event tags.<\/li>\n\n\n\n<li>Inject the CSS to style the tags for a clean and professional look.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-implement-the-snippet\"><strong>How to Implement the Snippet<\/strong><\/h3>\n\n\n\n<p>The easiest and safest way to add this functionality is by using a code snippets plugin. Alternatively, advanced users can add it to their child theme&#8217;s <code>functions.php<\/code> file.<\/p>\n\n\n\n<p>Step 1: Copy the Code<br>Copy the entire PHP snippet provided below.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/**\n * Auto-create template override for event tags in list view\n *\/\n\n\/\/ Hook into init to create the template override\nadd_action( &#039;init&#039;, &#039;create_event_tags_template_override&#039; );\nfunction create_event_tags_template_override() {\n    \/\/ Only run once\n    if ( get_option( &#039;event_tags_template_created&#039; ) ) {\n        return;\n    }\n\n    $theme_dir = get_stylesheet_directory();\n    $template_dir = $theme_dir . &#039;\/tribe\/events\/v2\/list&#039;;\n    $template_file = $template_dir . &#039;\/event.php&#039;;\n\n    \/\/ Create directories if they don&#039;t exist\n    if ( ! file_exists( $template_dir ) ) {\n        wp_mkdir_p( $template_dir );\n    }\n\n    \/\/ Create the template file\n    if ( ! file_exists( $template_file ) ) {\n        $template_content = &#039;&lt;?php\n\/**\n * View: List Event with Tags\n *\n * Auto-generated template override for event tags\n *\/\n$container_classes = &#x5B; \\&#039;tribe-common-g-row\\&#039;, \\&#039;tribe-events-calendar-list__event-row\\&#039; ];\n$container_classes&#x5B;\\&#039;tribe-events-calendar-list__event-row--featured\\&#039;] = $event-&gt;featured;\n\n$event_classes = tribe_get_post_class( &#x5B; \\&#039;tribe-events-calendar-list__event\\&#039;, \\&#039;tribe-common-g-row\\&#039;, \\&#039;tribe-common-g-row--gutters\\&#039; ], $event-&gt;ID );\n?&gt;\n&lt;div &lt;?php tribe_classes( $container_classes ); ?&gt;&gt;\n\n\t&lt;?php $this-&gt;template( \\&#039;list\/event\/date-tag\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\n\t&lt;div class=&quot;tribe-events-calendar-list__event-wrapper tribe-common-g-col&quot;&gt;\n\t\t&lt;article &lt;?php tribe_classes( $event_classes ) ?&gt;&gt;\n\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/featured-image\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\n\t\t\t&lt;div class=&quot;tribe-events-calendar-list__event-details tribe-common-g-col&quot;&gt;\n\n\t\t\t\t&lt;header class=&quot;tribe-events-calendar-list__event-header&quot;&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/date\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/title\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/venue\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t&lt;\/header&gt;\n\n\t\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/description\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\n\t\t\t\t&lt;?php $this-&gt;template( \\&#039;list\/event\/cost\\&#039;, &#x5B; \\&#039;event\\&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\n\t\t\t\t&lt;?php\n\t\t\t\t\/\/ Add event tags here\n\t\t\t\t$tags = get_the_terms( $event-&gt;ID, \\&#039;post_tag\\&#039; );\n\t\t\t\tif ( ! empty( $tags ) &amp;&amp; ! is_wp_error( $tags ) ) {\n\t\t\t\t\t$tags = array_values( array_filter( $tags, function( $term ) {\n\t\t\t\t\t\treturn $term instanceof WP_Term;\n\t\t\t\t\t} ) );\n\t\t\t\t\t\n\t\t\t\t\tif ( ! empty( $tags ) ) {\n\t\t\t\t\t\t$tag_links = &#x5B;];\n\t\t\t\t\t\tforeach ( $tags as $tag ) {\n\t\t\t\t\t\t\t$link = tribe_events_get_url( &#x5B;\n\t\t\t\t\t\t\t\t\\&#039;tag\\&#039; =&gt; $tag-&gt;slug, \n\t\t\t\t\t\t\t\t\\&#039;post_type\\&#039; =&gt; \\&#039;tribe_events\\&#039;, \n\t\t\t\t\t\t\t\t\\&#039;eventDisplay\\&#039; =&gt; \\&#039;default\\&#039; \n\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif ( ! is_wp_error( $link ) ) {\n\t\t\t\t\t\t\t\t$tag_links&#x5B;] = \\&#039;&lt;a href=&quot;\\&#039; . esc_url( $link ) . \\&#039;&quot; rel=&quot;tag&quot; class=&quot;tribe-event-tag-link&quot;&gt;\\&#039; . esc_html( $tag-&gt;name ) . \\&#039;&lt;\/a&gt;\\&#039;;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( ! empty( $tag_links ) ) {\n\t\t\t\t\t\t\techo \\&#039;&lt;div class=&quot;tribe-events-calendar-list__event-tags&quot;&gt;\\&#039;;\n\t\t\t\t\t\t\techo \\&#039;&lt;span class=&quot;tribe-event-tags-label&quot;&gt;\\&#039; . esc_html__( \\&#039;Tags:\\&#039;, \\&#039;the-events-calendar\\&#039; ) . \\&#039;&lt;\/span&gt; \\&#039;;\n\t\t\t\t\t\t\techo \\&#039;&lt;span class=&quot;tribe-event-tags&quot;&gt;\\&#039; . implode( \\&#039;, \\&#039;, $tag_links ) . \\&#039;&lt;\/span&gt;\\&#039;;\n\t\t\t\t\t\t\techo \\&#039;&lt;\/div&gt;\\&#039;;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t?&gt;\n\n\t\t\t&lt;\/div&gt;\n\t\t&lt;\/article&gt;\n\t&lt;\/div&gt;\n&lt;\/div&gt;\n&#039;;\n\n        file_put_contents( $template_file, $template_content );\n\n        \/\/ Mark as created\n        update_option( &#039;event_tags_template_created&#039;, true );\n    }\n}\n\n\/\/ Add CSS styling\nadd_action( &#039;wp_head&#039;, &#039;add_event_tags_list_view_styles&#039; );\nfunction add_event_tags_list_view_styles() {\n    if ( tribe_is_event_query() &amp;&amp; tribe_is_list_view() ) {\n        ?&gt;\n        &lt;style&gt;\n            .tribe-events-calendar-list__event-tags {\n                margin-top: 8px;\n                margin-bottom: 8px;\n                font-size: 0.85em;\n                color: #666;\n                line-height: 1.4;\n            }\n            \n            .tribe-event-tags-label {\n                font-weight: 600;\n                margin-right: 5px;\n                color: #333;\n            }\n            \n            .tribe-event-tag-link {\n                color: #0073aa;\n                text-decoration: none;\n                transition: color 0.2s ease;\n                background: #f7f7f7;\n                padding: 2px 6px;\n                border-radius: 3px;\n                margin-right: 3px;\n                display: inline-block;\n                margin-bottom: 3px;\n            }\n            \n            .tribe-event-tag-link:hover {\n                color: #005a87;\n                background: #e7f3ff;\n                text-decoration: none;\n            }\n            \n            .tribe-event-tags {\n                font-style: italic;\n            }\n        &lt;\/style&gt;\n        &lt;?php\n    }\n}\n?&gt;\n<\/pre><\/div>\n\n\n<p><strong>Step 2: Add the Snippet to Your Website<\/strong><\/p>\n\n\n\n<p>Choose one of the following methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Method 1: Using a Snippets Plugin (Recommended)<\/strong>\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Install and activate a free plugin like <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a>.<\/li>\n\n\n\n<li>Navigate to <strong>Snippets > Add New<\/strong> in your WordPress dashboard.<\/li>\n\n\n\n<li>Give your snippet a title, such as &#8220;Display Event Tags in List View&#8221;.<\/li>\n\n\n\n<li>Paste the copied code into the main code field.<\/li>\n\n\n\n<li>Select the option to &#8220;Only run on site front-end&#8221;.<\/li>\n\n\n\n<li>Save and activate the snippet.<br><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li><strong>Method 2: Using your Child Theme&#8217;s <code>functions.php<\/code> file<\/strong>\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Access your theme files via SFTP or your hosting control panel&#8217;s file manager.<\/li>\n\n\n\n<li>Navigate to <code>wp-content\/themes\/[your-child-theme-name]\/<\/code>.<\/li>\n\n\n\n<li>Open the <code>functions.php<\/code> file and paste the copied code at the end.<\/li>\n\n\n\n<li>Save the file. We strongly recommend using a child theme to prevent your changes from being overwritten during a theme update.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How It Works<\/strong><\/h3>\n\n\n\n<p>The first part of the snippet runs only once. It checks for a template file at <code>[your-theme]\/tribe\/events\/v2\/list\/event.php<\/code>. If the file doesn&#8217;t exist, the script creates it and populates it with the code needed to display tags. It then sets an option in the database to prevent this creation process from running again.<\/p>\n\n\n\n<p>The second part of the snippet adds custom CSS to your site&#8217;s header, but only when viewing the calendar&#8217;s list view. This ensures the styles are applied efficiently and only where needed.<\/p>\n\n\n\n<p>This code was tested with The Events Calendar version 6.4.1.<\/p>\n\n\n\n<p>Review the following guides for more information on customizing The Events Calendar:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/k\/customizing-template-files\/\" target=\"_blank\" rel=\"noreferrer noopener\">Customizing Template Files<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.google.com\/search?q=https:\/\/staging.theeventscalendar.com\/knowledgebase\/k\/template-files\/\" target=\"_blank\" rel=\"noreferrer noopener\">The Events Calendar Template Files<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you use standard WordPress tags to categorize your events, you might want to display them directly on The Events Calendar&#8217;s list view. This allows visitors to see an event&#8217;s topics at a glance and click to find related events. This guide provides a single code snippet that automates the entire process. It will: How&#8230;<\/p>\n","protected":false},"author":69,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[1],"tags":[20,23,25,215,58],"stellar-product-taxonomy":[],"class_list":["post-1966550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-code","tag-css","tag-customizations","tag-list-view","tag-php"],"acf":[],"taxonomy_info":{"category":[{"value":1,"label":"Uncategorized"}],"post_tag":[{"value":20,"label":"Code"},{"value":23,"label":"CSS"},{"value":25,"label":"Customizations"},{"value":215,"label":"list view"},{"value":58,"label":"PHP"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Chika","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/chika\/"},"comment_info":0,"category_info":[{"term_id":1,"name":"Uncategorized","slug":"uncategorized","term_group":0,"term_taxonomy_id":1,"taxonomy":"category","description":"","parent":0,"count":139,"filter":"raw","term_order":"0","cat_ID":1,"category_count":139,"category_description":"","cat_name":"Uncategorized","category_nicename":"uncategorized","category_parent":0}],"tag_info":[{"term_id":20,"name":"Code","slug":"code","term_group":0,"term_taxonomy_id":20,"taxonomy":"post_tag","description":"","parent":0,"count":33,"filter":"raw","term_order":"0"},{"term_id":23,"name":"CSS","slug":"css","term_group":0,"term_taxonomy_id":23,"taxonomy":"post_tag","description":"","parent":20,"count":48,"filter":"raw","term_order":"0"},{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":177,"filter":"raw","term_order":"0"},{"term_id":215,"name":"list view","slug":"list-view","term_group":0,"term_taxonomy_id":215,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw","term_order":"0"},{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":128,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1966550"}],"version-history":[{"count":5,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966550\/revisions"}],"predecessor-version":[{"id":1966555,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966550\/revisions\/1966555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1966550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1966550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1966550"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1966550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}