{"id":1963272,"date":"2024-10-24T11:32:11","date_gmt":"2024-10-24T15:32:11","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?p=1963272"},"modified":"2024-10-24T11:32:12","modified_gmt":"2024-10-24T15:32:12","slug":"template-overrides-for-event-schedule-manager","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/template-overrides-for-event-schedule-manager\/","title":{"rendered":"Template Overrides for Event Schedule Manager"},"content":{"rendered":"\n<p>Creating template overrides in Event Schedule Manager (ESM) might be not as straightforward, but it&#8217;s not rocket science either. Let&#8217;s see.<\/p>\n\n\n\n<p>ESM has templates for three of its post types: sessions, speakers, and sponsors. The respective template files can be found in the <code>event-schedule-manager\/templates\/<\/code> folder.<\/p>\n\n\n\n<p>Although the plugin does not include a built-in method for creating template overrides for these, a simple snippet can do the trick.<\/p>\n\n\n\n<p>Check out our article about\u00a0<a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/best-practices-for-implementing-custom-code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">how to best implement custom code snippets<\/a>\u00a0on your site.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;single_template&#039;, function( $template ) {\n\t\/\/ Bail, if not Event Schedule Manager\n\tif ( ! str_contains( $template, &#039;event-schedule-manager\/templates&#039;) ) {\n\t\treturn $template;\n\t}\n\n\t\/\/ Get the template override.\n\t$template_override = trailingslashit( get_stylesheet_directory() ) . &#039;event-schedule-manager\/&#039; . basename( $template );\n\t\n\t\/\/ Check if the file exists.\n\tif ( file_exists( $template_override ) ) {\n\t\treturn $template_override;\n\t}\n\n\treturn $template;\n}, 20, 1 );\n<\/pre><\/div>\n\n\n<p>The above snippet will instruct WordPress that if one of the templates from Event Schedule Manager is about to be used, first check if there is a template override available in the child theme, and make use of that.<\/p>\n\n\n\n<p>Let&#8217;s talk about the files themselves. <\/p>\n\n\n\n<p>First, go to your child theme folder (<code>wp-content\/themes\/{your-child-theme}<\/code>) and create a folder named <code>event-schedule-manager<\/code>.<\/p>\n\n\n\n<p>Then copy and paste the template files you want to override from the <code>wp-content\/plugins\/event-schedule-manager\/templates\/<\/code> folder in the newly created folder in your child theme.<\/p>\n\n\n\n<p>In the end, the folder and file structure for the overrides should look like this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nwp root\n|-- wp-content\n    |-- themes\n        |-- my-child-theme\n            |-- event-schedule-manager\n                |-- session-template.php\n                |-- speaker-template.php\n                |-- sponsor-template.php\n<\/pre><\/div>\n\n\n<p>Now you can start editing these templates to your heart&#8217;s desire.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating template overrides in Event Schedule Manager (ESM) might be not as straightforward, but it&#8217;s not rocket science either. Let&#8217;s see. ESM has templates for three of its post types: sessions, speakers, and sponsors. The respective template files can be found in the event-schedule-manager\/templates\/ folder. Although the plugin does not include a built-in method for&#8230;<\/p>\n","protected":false},"author":17,"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":[24,79,84],"tags":[25,207],"stellar-product-taxonomy":[205],"class_list":["post-1963272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-snippets","category-theming-overview","tag-customizations","tag-template-override","stellar-product-taxonomy-event-schedule-manager"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":79,"label":"Snippets"},{"value":84,"label":"Templating &amp; Layout"}],"post_tag":[{"value":25,"label":"Customizations"},{"value":207,"label":"Template override"}],"stellar-product-taxonomy":[{"value":205,"label":"Event Schedule Manager"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Andras Guseo","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/andras\/"},"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":110,"filter":"raw","term_order":"0","cat_ID":24,"category_count":110,"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":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0},{"term_id":84,"name":"Templating &amp; Layout","slug":"theming-overview","term_group":0,"term_taxonomy_id":84,"taxonomy":"category","description":"","parent":24,"count":59,"filter":"raw","term_order":"0","cat_ID":84,"category_count":59,"category_description":"","cat_name":"Templating &amp; Layout","category_nicename":"theming-overview","category_parent":24}],"tag_info":[{"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":207,"name":"Template override","slug":"template-override","term_group":0,"term_taxonomy_id":207,"taxonomy":"post_tag","description":"","parent":0,"count":4,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1963272","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\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1963272"}],"version-history":[{"count":5,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1963272\/revisions"}],"predecessor-version":[{"id":1963277,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1963272\/revisions\/1963277"}],"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=1963272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1963272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1963272"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1963272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}