{"id":1171,"date":"2019-07-12T13:04:06","date_gmt":"2019-07-12T13:04:06","guid":{"rendered":"https:\/\/webnus.site\/dox\/?p=1171"},"modified":"2023-10-31T10:34:05","modified_gmt":"2023-10-31T10:34:05","slug":"overriding-single-event-page","status":"publish","type":"knowledgebase","link":"https:\/\/webnus.net\/dox\/modern-events-calendar\/overriding-single-event-page\/","title":{"rendered":"Overriding Single Event Page"},"content":{"rendered":"\n<p>In this article, we will explain the process of overriding single event page.\u00a0<\/p>\n\n\n\n<p>MEC is created by developers for developers! And it\u2019s highly developer-friendly so you can simply override <a href=\"https:\/\/webnus.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">MEC<\/a> templates in your <a href=\"https:\/\/webnus.net\/deep-premium-wordpress-theme\/\" target=\"_blank\" rel=\"noreferrer noopener\">theme<\/a> and make it compatible with your theme style or use MEC filters\/actions to customize it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Overriding_Single_Event_Page\"><\/span>Overriding Single Event Page<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With the Overriding Modern Events Calendar <a href=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/single-event-settings\/\" target=\"_blank\" data-type=\"knowledgebase\" data-id=\"119\" rel=\"noreferrer noopener\">Single Event Page<\/a> feature, as a developer, you can easily adjust themes and customize your website in the best possible way.<\/p>\n\n\n\n<p>MEC has a number of template files in \/path\/to\/modern-events-calendar\/templates\/, you can simply override them in your theme or child theme.<\/p>\n\n\n\n<p>For instance, place them on the \/path\/to\/theme\/single-mec-events.php\u00a0or\u00a0\/path\/to\/child-theme\/single-mec-events.php.<\/p>\n\n\n\n<p><strong>Note:<\/strong> If you use the lite version of MEC insert <strong>-lite<\/strong>\u00a0after \u201cmodern-events-calendar\u201d.Let&#8217;s learn how to build an exclusive Single Event Page for our events.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_PHP_file_in_the_theme_folder\"><\/span>Creating a PHP file in the theme folder<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, create a PHP file in the root folder of your theme named single-mec-events.php.<\/p>\n\n\n\n<p>Then, in coding, call the main WordPress functions of get_header and get_footer.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nget_header();\n\nget_footer();\n<\/pre><\/div>\n\n\n<p>Now, you can place all your desired content between those 2 functions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Supported_PHP_functions\"><\/span>Supported PHP functions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before getting any necessary fields for MEC, it is worth mentioning that the MEC plugin supports the main functions like getting titles, content, categories, tags, and featured images, however, loading other items needs to be done using the defined functions in\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>#<\/th><th>Name<\/th><th>Code<\/th><\/tr><\/thead><tbody><tr><td>01<\/td><td>Title<\/td><td>get_the_title(); \/ the_title();<\/td><\/tr><tr><td>02<\/td><td>Content<\/td><td>get_the_content(); \/ the_content();<\/td><\/tr><tr><td>03<\/td><td>Thumbnail<\/td><td>the_post_thumbnail(); \/ the_post_thumbnail(&#8216;full&#8217;);<\/td><\/tr><tr><td>04<\/td><td>Tag<\/td><td>get_the_tags();<\/td><\/tr><tr><td>05<\/td><td>Label<\/td><td>get_terms( array(&#8216;taxonomy&#8217; =&gt; &#8216;mec_label&#8217;,&#8217;hide_empty&#8217; =&gt; false,));<\/td><\/tr><tr><td>06<\/td><td>Category<\/td><td>get_terms(array(&#8216;taxonomy&#8217; =&gt; &#8216;mec_category&#8217;,&#8217;hide_empty&#8217; =&gt; false,));<\/td><\/tr><tr><td>07<\/td><td>Event Color<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_color&#8217;, true );<\/td><\/tr><tr><td>08<\/td><td>Start Date<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_start_date&#8217;, true );<\/td><\/tr><tr><td>09<\/td><td>Start Hours<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_start_time_hour&#8217;, true);<\/td><\/tr><tr><td>10<\/td><td>Start Minute<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_start_time_minutes&#8217;, true);<\/td><\/tr><tr><td>11<\/td><td>Start AM\/PM<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_start_time_ampm&#8217;, true);<\/td><\/tr><tr><td>12<\/td><td>End Date<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_end_date&#8217;, true );<\/td><\/tr><tr><td>13<\/td><td>End Hours<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_end_time_hour&#8217;, true);<\/td><\/tr><tr><td>14<\/td><td>End Minute<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_end_time_minutes&#8217;, true);<\/td><\/tr><tr><td>15<\/td><td>End AM\/PM<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_end_time_ampm&#8217;, true);<\/td><\/tr><tr><td>16<\/td><td>MEC Comment<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_comment&#8217;, true );<\/td><\/tr><tr><td>17<\/td><td>Read More<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_read_more&#8217;, true);<\/td><\/tr><tr><td>18<\/td><td>More Info<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_more_info&#8217;, true);<\/td><\/tr><tr><td>19<\/td><td>Cost<\/td><td>get_post_meta( get_the_ID(), &#8216;mec_cost&#8217;, true );<\/td><\/tr><tr><td>20<\/td><td>Event Excerpt<\/td><td>get_the_excerpt();<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Modern_Events_Calendar_Widgets\"><\/span>Modern Events Calendar Widgets<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you need to load the MEC&#8217;s widgets, please proceed as follows:<br>You should first add the following code in the PHP file &#8220;single-mec-events.php&#8221; you placed in the theme&#8217;s root directory.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n$single = new MEC_skin_single();\n$single_event_main = $single-&gt;get_event_mec(get_the_ID());\n$single_event_obj = $single_event_main&#x5B;0];\n<\/pre><\/div>\n\n\n<p>Then call the widgets:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ attendees widget\n$single-&gt;display_attendees_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Booking Module\n$single-&gt;display_booking_widget($single_event_obj,$single_event_main);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ breadcrumb\n$single-&gt;display_breadcrumb_widget( get_the_ID() );\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Category Widget\n$single-&gt;display_category_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Cost Widget\n$single-&gt;display_cost_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Countdown Widget\n$single-&gt;display_countdown_widget($single_event_main);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Date Widget\n$single-&gt;display_date_widget($single_event_o\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Export Widget\n$single-&gt;display_export_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Google map widget\n$single-&gt;display_map_widget($single_event_main);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Hourly\n$single-&gt;display_hourly_schedules_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Label Widget\n$single-&gt;display_label_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Local Time widget\n$single-&gt;display_local_time_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Location Widget\n$single-&gt;display_location_widget($single_event_obj); \/\/ Show Location\n$single-&gt;display_other_location_widget($single_event_obj); \/\/ Show Additional Locations\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ More info widget\n$single-&gt;display_more_info_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ next\/prev widgets\n$single-&gt;display_next_prev_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Organizer Widget\n$single-&gt;display_organizer_widget($single_event_obj); \/\/ show Organizer\n$single-&gt;display_other_organizer_widget($single_event_obj); \/\/ additional Organizers\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ QR widget\n$single-&gt;display_qrcode_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Register Button\n$single-&gt;display_register_button_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/Social\n$single-&gt;display_social_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Speakers widget\n$single-&gt;display_speakers_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Time Widget\n$single-&gt;display_time_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Weather Widget\n$single-&gt;display_weather_widget($single_event_obj);\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Event Hourly Schedule\n$single-&gt;display_hourly_schedules_widget($single_event_obj);\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>MEC is created by developers for developers! And it\u2019s highly developer-friendly so you can simply override MEC templates in your theme and make it compatible with your theme style or use MEC filters\/actions to customize it.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","knowledgebase_cat":[50],"class_list":["post-1171","knowledgebase","type-knowledgebase","status-publish","hentry","knowledgebase_cat-developer-other"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/1171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/types\/knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/comments?post=1171"}],"version-history":[{"count":2,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/1171\/revisions"}],"predecessor-version":[{"id":9794,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/1171\/revisions\/9794"}],"wp:attachment":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/media?parent=1171"}],"wp:term":[{"taxonomy":"knowledgebase_cat","embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase_cat?post=1171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}