{"id":1633891,"date":"2018-09-29T15:37:44","date_gmt":"2018-09-29T22:37:44","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/"},"modified":"2018-09-29T15:37:44","modified_gmt":"2018-09-29T22:37:44","slug":"template-override-problemafter-update","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/","title":{"rendered":"template override problemafter update?"},"content":{"rendered":"<p>i have a manual over ride as below<br \/>\nOverride this template in your own theme by creating a file at [your-theme]\/tribe-events\/month\/single-event.php<\/p>\n<p>since update i geterror server 500 when trying to search calendars<\/p>\n<p>iff i rename this file to off_single-event.php  then all is well again.<br \/>\nlooking for changelog is NOT user friendly here , must be using something that has been dropped contents of said file are as follows ,anything lookobvious?<\/p>\n<pre><code>&lt;?php\n\n\/**\n * Month Single Event\n * This file contains one event in the month view\n *\n * Override this template in your own theme by creating a file at [your-theme]\/tribe-events\/month\/single-event.php\n *\n * @package TribeEventsCalendar\n *\n *\/\njq\nif ( ! defined( &#039;ABSPATH&#039; ) ) {\n\tdie( &#039;-1&#039; );\n}\n\nglobal $post;\n\n\/**\n * We build and gather information specific to the individual event prior to\n * the tribe_events_template_data() call to reduce the opportunities for 3rd\n * party code to call wp_reset_postdata() or similar, which can result in the\n * $post global referencing something other than the event we&#039;re interested\n * in.\n *\/\n\n$day             = tribe_events_get_current_month_day();\n$event_id        = &quot;{$post-&gt;ID}-{$day[&#039;daynum&#039;]}&quot;;\n$link            = tribe_get_event_link( $post );\n$title           = get_the_title( $post );\n$additional_data = array();\n$STAKE = tribe_get_custom_field(&#039;STAKE&#039;);\n$ENTRIES_CLOSE = tribe_get_custom_field(&#039;ENTRIES_CLOSE&#039;);\n$DRAW_DATE = tribe_get_custom_field(&#039;DRAW_DATE&#039;); \n$additional_data[&#039;STAKE&#039;] = $STAKE ;\n$additional_data[&#039;ENTRIES_CLOSE&#039;] = $ENTRIES_CLOSE ;\n$additional_data[&#039;DRAW_DATE&#039;] = $DRAW_DATE ;\n\n\/**\n * How to Use the Javascript Templating System in this View\n * ========================================================\n *\n * Month view (and week in events pro) has implemented javascript templating to power its rich tooltips and mobile views\n * as of Events Version 3.3. This is a guide on how to modify, extend and use this functionality.\n *\n * 1) Overview\n *\n * As of version 3.3 our tooltips and mobile views use a custom javascript templating solution.\n *\n * How it works: event data for each event - such as title, start and end time, excerpt etc - is stored on a data\n * attribute tagged &quot;data-tribejson&quot; in the markup. This particular json works with simple single level key value pairs.\n * The key is used in the javascript template to call our value output.\n *\n * The javascript templates are stored in two new files in the views folder, mobile.php and tooltip.php. You can modify\n * these templates as you wish, and add new data to it for use either in these templates or anywhere on these views. The\n * javascript templates themselves are explained further on.\n *\n * This &quot;data-tribejson&quot; attribute contains a string of valid json that must have its double quotes escaped correctly so\n * it can be used both on a data att and for use in jquery&#039;s json methods. Scary? Dont worry, we&#039;ve taken care of this\n * encoding for you, find out how in the next section.\n *\n * 2) The Template Tags\n *\n * Two new template tags have been introduced to power this system:\n *\n *     tribe_events_template_data()\n *     tribe_prepare_for_json().\n *\n * tribe_events_template_data( $post_object, $additional_data )\n * ============================================================\n *\n * This is the main template tag that will output the string of valid json in the template file. It takes the event post\n * object and an optional php array with additional data for output in the json string. Right now we use this only in\n * month view in events, and week view in events pro. You can add it to other view files if you want handy event data\n * for use in your own javascript. The stock template tag supplies this json string (remember, the key on the left is\n * what we use in the javascript template file to call the data on the right):\n *\n *\t{\n *\t\t&quot;eventId&quot;: POST ID,\n *\t\t&quot;title&quot;: &quot;POST TITLE&quot;,\n *\t\t&quot;permalink&quot;: &quot;POST PERMALINK&quot;,\n *\t\t&quot;startTime&quot;: &quot;EVENT START TIME&quot;,\n *\t\t&quot;endTime&quot;: &quot;EVENT END TIME (MAY NOT BE SET)&quot;,\n *\t\t&quot;imageSrc&quot;: &quot;IMAGE THUMB FOR MOBILE(MAY NOT BE SET)&quot;,\n *\t\t&quot;imageTooltipSrc&quot;: &quot;IMAGE THUMB FOR TOOLTIP(MAY NOT BE SET)&quot;,\n *\t\t&quot;excerpt&quot;: &quot;POST EXCERPT&quot;\n *\t}\n *\n * tribe_prepare_for_json( $string )\n * =================================\n *\n * This template tag is used internally by the previous tag, but has been made public for your use as well. Please do\n * note that any additional params you pass into tribe_events_template_data() will automatically be passed through this\n * function and so you need not do that step manually.\n *\n * Lets say we want to add our own dynamic data from custom post meta to the javascript template for mobile. For now\n * lets say that the key name we want to use is &quot;hello&quot; in our js template. The following example shows how we would go\n * about adding the custom post meta and appending it to our event json string that is output in the markup.\n *\n *    $additional_data = array();\n *    $string = get_post_meta( get_the_ID(), &#039;hello_meta&#039; ); \/\/ this string can be anything\n *    $additional_data[&#039;hello&#039;] = $string;\n *    echo tribe_events_template_data( $post, $additional_data ); ?&gt;\n *\n * Explanation: we create an empty array to cram our data into. We can add as much as we want, there are no limits on\n * data attribute length in the html5 spec. We want to call this data with the word &quot;hello&quot; in the js template, so that\n * is the key name we give it in the php array.\n *\n * After we have our data we supply it along with the post object. Now we&#039;ll cover the javascript template.\n *\n * 3) The Javascript Templates\n *\n * As said earlier the templates are stored in tooltip.php and mobile.php in the month view folder. Javascript templates\n * are simply standard html markup with keys wrapped in an expression that our parsing function uses to populate the\n * values to. Our expression is a [[, THE KEY, followed by a ]]\n *\n * The template has 3 modes when parsing these.\n *\n *    [[ ]] is for executing javascript you place between the expression. Note below how we test for the presence of an\n *          end time and image thumbnail using this.\n *\n *    [[= ]] Is for a string with escaped html.\n *\n *    [[=raw ]] Is for a string with html preserved. make sure to test for xss vulnerabilities using this method.\n *\n * Now lets look at the tooltip template. Compare the keys in it to the json string in section 2 above to map out whats\n * going on.\n *\n *\n *\n *\t&lt;script type=&quot;text\/html&quot; id=&quot;tribe_tmpl_tooltip&quot;&gt;\n *\t\t&lt;div id=&quot;tribe-events-tooltip-[[=eventId]]&quot; class=&quot;tribe-events-tooltip&quot;&gt;\n *\t\t\t&lt;h4 class=&quot;tribe-event-title&quot;&gt;[[=title]]&lt;\/h4&gt;\n *\t\t\t&lt;div class=&quot;tribe-events-event-body&quot;&gt;\n *\t\t\t\t&lt;div class=&quot;tribe-event-duration&quot;&gt;\n *\t\t\t\t\t&lt;abbr class=&quot;tribe-events-abbr tribe-event-date-start&quot;&gt;[[=startTime]] &lt;\/abbr&gt;\n *\t\t\t[[ if(endTime.length) { ]]\n *\t\t\t\t\t-&lt;abbr class=&quot;tribe-events-abbr tribe-event-date-end&quot;&gt; [[=endTime]]&lt;\/abbr&gt;\n *\t\t\t[[ } ]]\n *\t\t\t\t&lt;\/div&gt;\n *\t\t\t[[ if(imageTooltipSrc.length) { ]]\n *\t\t\t\t&lt;div class=&quot;tribe-events-event-thumb&quot;&gt;\n *\t\t\t\t\t&lt;img src=&quot;[[=imageTooltipSrc]]&quot; alt=&quot;[[=title]]&quot; \/&gt;\n *\t\t\t\t&lt;\/div&gt;\n *\t\t\t[[ } ]]\n *\t\t\t[[ if(excerpt.length) { ]]\n *\t\t\t\t&lt;p class=&quot;entry-summary description&quot;&gt;[[=raw excerpt]]&lt;\/p&gt;\n *\t\t\t[[ } ]]\n *\t\t\t\t&lt;span class=&quot;tribe-events-arrow&quot;&gt;&lt;\/span&gt;\n *\t\t\t&lt;\/div&gt;\n *\t\t&lt;\/div&gt;\n *\t&lt;\/script&gt;\n *\n *\n * Please note when creating your own data to feed to this that you must supply the key every time, even if the value is\n * empty. The templating function will error if one of the keys in the template is missing from the json.\n *\n * 4) Using the JSON String In Your Own Javascript\n *\n * OK, so we&#039;ve gone though how to use, modify and extend the existing templates. But you&#039;ve probably noticed &quot;Hey, I\n * have all the event data for each event in a tidy json string, I want to use that in my own js for something&quot;\n *\n * Its really quite easy.\n *\n * Plain javascript to loop over all events in grid view, get the json string, convert to object and log event title:\n *\n * \t(function (window, document) {\n *\n *\t\tvar events = document.querySelectorAll(&#039;.tribe_events&#039;);\n *\n *\t\tfor (var i=0; i &lt; events.length; i++) {\n *\n *\t\t\tvar event = events[i],\n *\t\t\t\tdata = event.getAttribute(&#039;data-tribejson&#039;),\n *\t\t\t\tobj = JSON.parse(data);\n *\n *\t\t\tconsole.log(&#039;Event title is: &#039; + obj.title);\n *\t\t}\n *\n *\t})(window, document);\n *\n * Same thing in jQuery:\n *\n *\t(function (window, document, $) {\n *\n *\t\t$(document).ready(function () {\n *\n *\t\t\t$(&#039;.tribe_events&#039;)\n *\t\t\t\t.each(function () {\n *\n *\t\t\t\t\tvar obj = $(this).data(&#039;tribejson&#039;);\n *\n *\t\t\t\t\tconsole.log(&#039;Event title is: &#039; + obj.title);\n *\n *\t\t\t\t});\n *\n *\t\t});\n *\n *\t})(window, document, jQuery);\n *\n *\/\n?&gt;\n\n&lt;div id=&quot;tribe-events-event-&lt;?php echo esc_attr( $event_id ); ?&gt;&quot; class=&quot;&lt;?php tribe_events_event_classes() ?&gt;&quot; data-tribejson=&#039;&lt;?php echo esc_attr( tribe_events_template_data( $post, $additional_data ) ); ?&gt;&#039;&gt;\n\t&lt;h3 class=&quot;tribe-events-month-event-title&quot;&gt;&lt;a href=&quot;&lt;?php echo esc_url( $link ) ?&gt;&quot; class=&quot;url&quot;&gt;&lt;?php echo $title ?&gt;&lt;\/a&gt;&lt;\/h3&gt;\n&lt;\/div&gt;&lt;!-- #tribe-events-event-# --&gt;\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-1633891","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>template override problemafter update? -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"template override problemafter update? -\" \/>\n<meta property=\"og:description\" content=\"i have a manual over ride as below Override this template in your own theme by creating a file at [your-theme]\/tribe-events\/month\/single-event.php since update i geterror server 500 when trying to search calendars iff i rename this file to off_single-event.php then all is well again. looking for changelog is NOT user friendly here , must be [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/\",\"name\":\"template override problemafter update? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-09-29T22:37:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"template override problemafter update?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"template override problemafter update? -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/","og_locale":"en_US","og_type":"article","og_title":"template override problemafter update? -","og_description":"i have a manual over ride as below Override this template in your own theme by creating a file at [your-theme]\/tribe-events\/month\/single-event.php since update i geterror server 500 when trying to search calendars iff i rename this file to off_single-event.php then all is well again. looking for changelog is NOT user friendly here , must be [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/","name":"template override problemafter update? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-09-29T22:37:44+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/template-override-problemafter-update\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"template override problemafter update?"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1633891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1633891\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1633891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}