{"id":1896674,"date":"2019-10-18T13:19:50","date_gmt":"2019-10-18T17:19:50","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/show-the-sold-out-message-for-events-that-are-in-the-past\/"},"modified":"2022-06-21T08:51:54","modified_gmt":"2022-06-21T12:51:54","slug":"show-the-sold-out-message-for-events-that-are-in-the-past","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/show-the-sold-out-message-for-events-that-are-in-the-past\/","title":{"rendered":"Show &#8220;Sold Out!&#8221; for Past Events"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-description\">Description<\/h2>\n\n\n\n<p>By default, the <strong>&#8216;Sold out!&#8217;<\/strong> message is not shown for past events. This snippet brings it back.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-screenshot\">Screenshot<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2019\/10\/sold-out.png\" alt=\"\" class=\"wp-image-1944239\"\/><figcaption>Front end with the legacy views<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-11.05.47-AM-1-1024x264.png\" alt=\"\" class=\"wp-image-1952493\"\/><figcaption>Front end with the updated calendar views<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-usage\">Usage<\/h2>\n\n\n\n<p>Copy the below code into your (child) theme&#8217;s <em>functions.php<\/em> file (or wherever you usually put custom php code).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-plugins\">Plugins<\/h2>\n\n\n\n<p>Event Tickets<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-snippet\">Snippet<\/h2>\n\n\n\n<p>This is the snippet you&#8217;ll want to add to your theme&#8217;s functions.php file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/**\n * Change the Get Tickets on List View and Single Events\n *\n * @param string $translation The translated text.\n * @param string $text    \tThe text to translate.\n * @param string $domain  \tThe domain slug of the translated text.\n *\n * @return string The translated text or the custom text.\n *\/\n \nadd_filter( &#039;gettext&#039;, &#039;tribe_change_get_tickets&#039;, 20, 4 );\nfunction tribe_change_get_tickets( $translation, $text, $domain) {    \n  if ( $domain != &#039;default&#039;\n   \t&amp;&amp; strpos( $domain, &#039;event-&#039; ) !== 0\n  ) {\n\treturn $translation;\n  }\n \n  $ticket_text = &#x5B;\n\t\/\/ Get Tickets on List View\n\t&#039;%s are no longer available&#039;  \t=&gt; &#039;Sold Out&#039;,\n  ];\n \n  \/\/ If we don&#039;t have replacement text, bail.\n  if ( empty( $ticket_text&#x5B; $text ] ) ) {\n\treturn $translation;\n  }\n \n  return $ticket_text&#x5B; $text ];\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-notes\">Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Originally written in November 2018<\/li><li>Tested with Event Tickets 4.8.4<\/li><li>Author: Andr\u00e1s Guseo<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-disclaimer\">Disclaimer<\/h2>\n\n\n\n<p>As with all of our recipes, please note that we share this in the hope it will be useful <strong>but without any guarantees or commitments<\/strong>. If you wish to use it, it is <em>your<\/em> responsibility to test it first of all and adapt it to your needs (or find someone who can do so on your behalf). We are unable to provide further support in relation to this recipe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description By default, the &#8216;Sold out!&#8217; message is not shown for past events. This snippet brings it back. Screenshot Usage Copy the below code into your (child) theme&#8217;s functions.php file (or wherever you usually put custom php code). Plugins Event Tickets Snippet This is the snippet you&#8217;ll want to add to your theme&#8217;s functions.php file:&#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":[79],"tags":[25,58],"stellar-product-taxonomy":[155,156],"class_list":["post-1896674","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets","tag-customizations","tag-php","stellar-product-taxonomy-event-tickets","stellar-product-taxonomy-event-tickets-plus"],"acf":[],"taxonomy_info":{"category":[{"value":79,"label":"Snippets"}],"post_tag":[{"value":25,"label":"Customizations"},{"value":58,"label":"PHP"}],"stellar-product-taxonomy":[{"value":155,"label":"Event Tickets"},{"value":156,"label":"Event Tickets Plus"}]},"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":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\/1896674","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=1896674"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896674\/revisions"}],"predecessor-version":[{"id":1956150,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1896674\/revisions\/1956150"}],"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=1896674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1896674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1896674"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1896674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}