{"id":1550779,"date":"2018-06-11T08:59:44","date_gmt":"2018-06-11T15:59:44","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/"},"modified":"2018-06-11T08:59:44","modified_gmt":"2018-06-11T15:59:44","slug":"move-load_ecp_into_page_template-to-a-custom-hook","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/","title":{"rendered":"Move `load_ecp_into_page_template` to a custom hook"},"content":{"rendered":"<p>For years, I&#8217;ve had issues with the way Tribe Events inserts its custom templates, and for years, I&#8217;ve tried to fix it, to no avail.<\/p>\n<p>Because Tribe Events hooks in to the_content to insert its templates, many filters get applied to the markup that I don&#8217;t want to be applied. For example, line breaks (<code>&lt;br&gt;<\/code>) get added when line breaks appear in the templates, paragraph tags wrap comments, etc. It&#8217;s essentially just as bad as using a shortcode.<\/p>\n<p>The solution I&#8217;ve been trying to implement is rather simple; I want to unhook <code>load_ecp_into_page_template<\/code> from <code>the_content<\/code>, and instead hook it in to <code>tribe_events_templates<\/code>. This sounds easy, but because of the way the classes are constructed, I&#8217;ve had a hell of a time figuring out exactly how to do this.<\/p>\n<p>I would greatly appreciate a little guidance from one of your developers on how to achieve this goal.<\/p>\n<p>The line in question is located at <code>src\/Tribe\/Templates.php:293<\/code>. It&#8217;s part of the function <code>setup_ecp_template<\/code>, which is part of the class <code>Tribe__Events__Templates<\/code>, which extends the class <code>Tribe__Templates<\/code>.<\/p>\n<p>If I&#8217;m going about this completely wrong, please let me know. Any guidance on how to display the templates without passing them through <code>the_content()<\/code> would be great.<\/p>\n","protected":false},"template":"","class_list":["post-1550779","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>Move `load_ecp_into_page_template` to a custom hook -<\/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\/move-load_ecp_into_page_template-to-a-custom-hook\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Move `load_ecp_into_page_template` to a custom hook -\" \/>\n<meta property=\"og:description\" content=\"For years, I&#8217;ve had issues with the way Tribe Events inserts its custom templates, and for years, I&#8217;ve tried to fix it, to no avail. Because Tribe Events hooks in to the_content to insert its templates, many filters get applied to the markup that I don&#8217;t want to be applied. For example, line breaks (&lt;br&gt;) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/\",\"name\":\"Move `load_ecp_into_page_template` to a custom hook -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-06-11T15:59:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/#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\":\"Move `load_ecp_into_page_template` to a custom hook\"}]},{\"@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":"Move `load_ecp_into_page_template` to a custom hook -","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\/move-load_ecp_into_page_template-to-a-custom-hook\/","og_locale":"en_US","og_type":"article","og_title":"Move `load_ecp_into_page_template` to a custom hook -","og_description":"For years, I&#8217;ve had issues with the way Tribe Events inserts its custom templates, and for years, I&#8217;ve tried to fix it, to no avail. Because Tribe Events hooks in to the_content to insert its templates, many filters get applied to the markup that I don&#8217;t want to be applied. For example, line breaks (&lt;br&gt;) [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/","name":"Move `load_ecp_into_page_template` to a custom hook -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-06-11T15:59:44+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/move-load_ecp_into_page_template-to-a-custom-hook\/#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":"Move `load_ecp_into_page_template` to a custom hook"}]},{"@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\/1550779","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\/1550779\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1550779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}