{"id":1896562,"date":"2019-10-18T13:19:28","date_gmt":"2019-10-18T17:19:28","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/make-the-event-website-url-a-linked-word-or-button\/"},"modified":"2025-10-23T13:06:41","modified_gmt":"2025-10-23T17:06:41","slug":"make-the-event-website-url-a-linked-word-or-button","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/make-the-event-website-url-a-linked-word-or-button\/","title":{"rendered":"Make the Event Website URL a Linked Word or Button"},"content":{"rendered":"\n\n\n<p>By default, adding a URL to this field will result in that URL displaying on the event page using Classic Editor like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2015\/04\/kb-eventwebsite-link.jpg\" alt=\"kb-eventwebsite-link\"\/><\/figure><\/div>\n\n\n<p>That&#8217;s great and all, but what if we have a really long URL and would rather replace that with a linked word instead? What about a button? Awesome news: in The Events Calendar in Block Editor, this is already possible.<\/p>\n\n\n\n<p>We&#8217;ll walk through how to do both in this article for those of you holding on to Classic Editor mode.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"change-url\">Change the URL to a linked word<\/h3>\n\n\n\n<p>Our first goal will be to change the text from the URL to a&nbsp;&#8220;Visit Website&nbsp;\u2192&#8221;&nbsp;label that is still linked to the same place. You&nbsp;can do that by adding the following snippet to your theme&#8217;s <i>functions.php<\/i> file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nfunction tribe_get_event_website_link_label_default( $label, $post_id ) {\n\t$url = tribe_get_event_website_url( $post_id );\n\tif ( $label === $url ) {\n\t\t$label = &#039;Visit Website \u00bb&#039;;\n\t}\n\n\treturn $label;\n}\n\nadd_filter( &#039;tribe_get_event_website_link_label&#039;, &#039;tribe_get_event_website_link_label_default&#039;, 10, 2 );\n<\/pre><\/div>\n\n\n<p>That will result in the URL being replaced with our &#8220;Visit Website&nbsp;\u00bb&#8221; label:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2015\/04\/kb-eventwebsite-linkedword.jpg\" alt=\"kb-eventwebsite-linkedword\"\/><\/figure><\/div>\n\n\n<p>If you&#8217;d like the website link to open in a new window, you can use the code below:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;tribe_get_event_website_link_target&#039;, static function() {\n    return &#039;_blank&#039;;\n} );\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"button\">Change the URL to a button<\/h3>\n\n\n\n<p>What, you want a button instead of a simple link? Let&#8217;s do&nbsp;that. Let&#8217;s first make a few changes to the snippet we used to make the link:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n\/**\n * The Events Calendar: Change the Event Website plain text link to a button, including shortening the anchor text to\n * avoid a really long button.\n *\/\nfunction tribe_change_event_website_link_to_button( $html ) {\n\n\t$label   = &quot;Visit Website \u00bb&quot;;\n\t$classes = &#039;button tribe-events-button tribe-common-c-btn tribe-common-c-btn--small&#039;;\n\n\tif ( false === strpos( $html, &#039;class=&quot;&#039; ) ) {\n\t\t$new_html = str_replace( &#039;href=&quot;&#039;, &#039;class=&quot;&#039; . $classes . &#039;&quot; href=&quot;&#039;, $html );\n\t}\n\telse {\n\t\t$new_html = str_replace( &#039;class=&quot;&#039;, &#039;class=&quot;&#039; . $classes . &#039; &#039;, $html );\n\t}\n\n\tif ( ! empty( $label ) ) {\n\t\t$new_html = preg_replace( &#039;\/\\&quot;\\&gt;.{2,}?(\\&lt;\\\/a&gt;)\/&#039;, &#039;&quot;&gt;&#039; . $label . &#039;&lt;\/a&gt;&#039;, $new_html );\n\t}\n\n\treturn $new_html;\n}\n\nadd_filter( &#039;tribe_get_event_website_link&#039;, &#039;tribe_change_event_website_link_to_button&#039; );\n<\/pre><\/div>\n\n\n<p>The class name(s) can be customized to your needs, of course. We included some common ones, but you might want to trim that list as you see fit. If you have a button style in your theme already, you can make it that. Or, if you&#8217;d prefer to design a special button for this link, then you could make up a new class name instead.<\/p>\n\n\n\n<p>Either way, once you have that class name, go into your theme&#8217;s&nbsp;<em>style.css<\/em> file and make sure that the class name both exists and is styled the way you would like your button to appear. For example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; gutter: false; title: ; notranslate\" title=\"\">\n.my-button-class {\n    background-color: red;\n    padding: 10px;\n    color: #fff;\n    float: left;\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2015\/04\/Screen-Shot-2015-04-30-at-12.35.00-PM-665x262.png\" alt=\"KB - button url\"\/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"remove-header\">Removing the &#8220;Website&#8221; heading<\/h3>\n\n\n\n<p>If you&#8217;ve changed the URL to a button or a link, you might want to remove the &#8220;Website&#8221; header above.<\/p>\n\n\n\n<p>To remove the heading:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make a copy of the <em>details.php<\/em> file. It is located in \/plugins\/the-events-calendar\/src\/views\/modules\/meta\/details.php.<\/li>\n\n\n\n<li>Make a new folder in your theme directory called\u00a0<em>tribe-events<\/em><\/li>\n\n\n\n<li>Make a new folder in that one called\u00a0<em>modules<\/em><\/li>\n\n\n\n<li>Make a new folder in that one called\u00a0<em>meta<\/em><\/li>\n\n\n\n<li>Drop the copied\u00a0<em>details.php<\/em> file in that last folder<\/li>\n<\/ul>\n\n\n\n<p>Now that the template is in the theme, it can be customized to suit your needs. In this case, remove the following line from the template:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1900\" height=\"500\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01.png\" alt=\"Remove lines from the code\" class=\"wp-image-1953933\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01.png 1900w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01-300x79.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01-1024x269.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01-768x202.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/08\/Screen-Shot-2022-08-12-at-10.48.01-1536x404.png 1536w\" sizes=\"auto, (max-width: 1900px) 100vw, 1900px\" \/><\/figure>\n\n\n\n<p>Once that has been saved and everything else is in place,&nbsp;you&#8217;ll see your button or link without the header:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2015\/04\/kb-eventwebsite-button.jpg\" alt=\"kb-eventwebsite-button\"\/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Wrapping up<\/h3>\n\n\n\n<p>There we have it: two ways to change the Event Website from a URL to something else. We hope you found this helpful and that it makes your calendar just that much more awesome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, adding a URL to this field will result in that URL displaying on the event page using Classic Editor like this: That&#8217;s great and all, but what if we have a really long URL and would rather replace that with a linked word instead? What about a button? Awesome news: in The Events&#8230;<\/p>\n","protected":false},"author":3,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","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":[24,79],"tags":[25,58],"stellar-product-taxonomy":[161],"class_list":["post-1896562","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-snippets","tag-customizations","tag-php","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":25,"label":"Customizations"},{"value":58,"label":"PHP"}],"stellar-product-taxonomy":[{"value":161,"label":"The Events Calendar"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Jaime Marchwinski","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/jaimetri-be\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":157,"filter":"raw","term_order":"0","cat_ID":24,"category_count":157,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":80,"filter":"raw","term_order":"0","cat_ID":79,"category_count":80,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":102,"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":78,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1896562"}],"version-history":[{"count":2,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896562\/revisions"}],"predecessor-version":[{"id":1961370,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896562\/revisions\/1961370"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1896562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1896562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1896562"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1896562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}