Support

Home Forums Event Espresso Premium Problems with Custom Templates Location

Problems with Custom Templates Location

Posted: March 28, 2014 at 5:55 pm

Viewing 0 reply threads


Bobby Girdher

March 28, 2014 at 5:55 pm

Hey all. I have purchased EE3 and have the custom files and custom templates add-ons. I have written a custom view for the event list called “Mindframe” and, to test it, I created a new page using the default wordpress page template and tested it out using the following short code: [EVENT_CUSTOM_VIEW template_name=”mindframe” category_identifier=”course-lego-mindstorms-kids”]

Everything worked fine and displayed exactly as I would have expected it to. For reference, a working URL is http://www.mindframeeducation.com/event-list-test/

I went to add this into a custom page template (part of a child theme that I Developed) and, using the exact same shortcode, I get the error message “the custom template mindframe can not be found”. (http://www.mindframeeducation.com/adventures-in-robotics-using-lego-mindstorms/)

I have dropped the template folder and files (mindframe/index.php) into just about every single directory imaginable and still cannot figure out why it is breaking. For reference, I have tried the following locations:

/
/wp-content/themes/
/wp-content/themes/parent_theme/
/wp-content/themes/parent_theme-child/
/wp-content/uploads/espresso/
/wp-content/uploads/espresso/templates
/wp-content/plugins/espresso-custom-templates/templates

I even tried to just overwrite the ‘events-table’ index.php with my code, and somehow that didn’t work as expected either.

My code is

<code>&lt;?php
//Template: Mindframe
//Description: This template is used in the Mindframe WordPress Template to display all events in a selected category
//Shortcode Example: [EVENT_CUSTOM_VIEW template_name=&quot;mindframe&quot;]
//The end of the action name (example: &quot;action_hook_espresso_custom_template_&quot;) should match the name of the template. In this example, the last part the action name is &quot;default&quot;,

add_action(&#039;action_hook_espresso_custom_template_mindframe&#039;,&#039;espresso_custom_template_mindframe&#039;);

function espresso_custom_template_mindframe(){

	global $this_event_id, $events, $wpdb;
	
	//Get the categories
	$sql = &quot;SELECT * FROM &quot; . EVENTS_CATEGORY_TABLE;
	$temp_cats = $wpdb-&gt;get_results($sql);

?&gt;

&lt;table class=&quot;ee-mf-course-availability&quot;&gt;

		&lt;?php

      foreach ($events as $event){
		$button_text 		= __(&#039;Register&#039;, &#039;event_espresso&#039;);
		$alt_button_text	= __(&#039;View Details&#039;, &#039;event_espresso&#039;);//For alternate registration pages
		$externalURL 		= $event-&gt;externalURL;
		$button_text		= !empty($externalURL) ? $alt_button_text : $button_text;
		$registration_url 	= !empty($externalURL) ? $externalURL : espresso_reg_url($event-&gt;id);
		if ( ! has_filter( &#039;filter_hook_espresso_get_num_available_spaces&#039; ) ){
			$open_spots		= apply_filters(&#039;filter_hook_espresso_get_num_available_spaces&#039;, $event-&gt;id); //Available in 3.1.37
		}else{
			$open_spots		= get_number_of_attendees_reg_limit($event-&gt;id, &#039;number_available_spaces&#039;);
		}
		$live_button 		= &#039;&lt;a id=&quot;a_register_link-&#039;.$event-&gt;id.&#039;&quot; href=&quot;&#039;.$registration_url.&#039;&quot;&gt;&#039;.$button_text.&#039;&lt;/a&gt;&#039;;
		$event_status 		= event_espresso_get_status($event-&gt;id);
		
		//Check for Multi Event Registration
		$multi_reg = false;
		if (function_exists(&#039;event_espresso_multi_reg_init&#039;)) {
			$multi_reg = true;
		}
		$cart_link 	= &#039;&#039;;
		
		//Create an add to cart link
		if ($multi_reg &amp;&amp; $event_status == &#039;ACTIVE&#039; &amp;&amp; empty($externalURL)) {
			$params = array(
				//REQUIRED, the id of the event that needs to be added to the cart
				&#039;event_id&#039; =&gt; $event-&gt;id,
				//REQUIRED, Anchor of the link, can use text or image
				&#039;anchor&#039; =&gt; __(&quot;Add to Cart&quot;, &#039;event_espresso&#039;), //&#039;anchor&#039; =&gt; &#039;&lt;img src=&quot;&#039; . EVENT_ESPRESSO_PLUGINFULLURL . &#039;images/cart_add.png&quot; /&gt;&#039;,
				//REQUIRED, if not available at this point, use the next line before this array declaration
				// $event_name = get_event_field(&#039;event_name&#039;, EVENTS_DETAIL_TABLE, &#039; WHERE id = &#039; . $event_id);
				&#039;event_name&#039; =&gt; $event-&gt;event_name,
				//OPTIONAL, will place this term before the link
				&#039;separator&#039; =&gt; &#039; &#039;.__(&quot;or&quot;, &#039;event_espresso&#039;).&#039; &#039;
			);

			$cart_link = event_espresso_cart_link($params);
		}
		
		if($open_spots &lt; 1 &amp;&amp; $event-&gt;allow_overflow == &#039;N&#039;) {
			$live_button = __(&#039;Sold Out&#039;, &#039;event_espresso&#039;);
			$cart_link = &#039;&#039;;
		} else if ($open_spots &lt; 1 &amp;&amp; $event-&gt;allow_overflow == &#039;Y&#039;){
			$live_button = !empty($event-&gt;overflow_event_id) ? &#039;&lt;a href=&quot;&#039;.espresso_reg_url($event-&gt;overflow_event_id).&#039;&quot;&gt;&#039;.__(&#039;Join Waiting List&#039;, &#039;event_espresso&#039;).&#039;&lt;/a&gt;&#039; : __(&#039;Sold Out&#039;, &#039;event_espresso&#039;);
			$cart_link = &#039;&#039;;
		}
		
		if ($event_status == &#039;NOT_ACTIVE&#039;) { 
			$live_button = __(&#039;Closed&#039;, &#039;event_espresso&#039;);
			$cart_link = &#039;&#039;;
		}

	   ?&gt;
	&lt;tr&gt;
		&lt;td id=&quot;start_date-&lt;?php echo $event-&gt;id?&gt;&quot; class=&quot;start_date&quot;&gt;&lt;?php echo event_date_display($event-&gt;start_date) ?&gt; - &lt;?php echo event_date_display($event-&gt;end_date) ?&gt;&lt;/td&gt;
		&lt;td class=&quot;td-group reg-col&quot; nowrap=&quot;nowrap&quot;&gt;&lt;?php echo $event_status == &#039;ACTIVE&#039; ? $live_button .  $cart_link : $live_button; ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;?php } //close foreach ?&gt;
&lt;/table&gt;

&lt;?php
}</code>

Any help would be greatly appreciated. I am pulling my hair out.

Viewing 0 reply threads

The support post ‘Problems with Custom Templates Location’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso