Posted: July 28, 2012 at 10:29 am
2 questions- Point 1-The EE_Meta data works fine in the registration_page_display.php with the following code
“I removed the signs before the ?php intentionally so the code could be read in this post” whereas the code doesn’t work in other templates such as the payment_overview.php, the confirmation_display.php etc.. Question, is there some standard code I can add in those templates so that the EE_Meta shortcode is picked up? I absolutely need to diplay this information because it’s the information which summarizes the begining and ending dates of a whole semester. I therfore need to display the info everywhere, (Invoices, confirmations, lists etc….) Point 2- When entering a new event there are already 3 default values when using the Event Meta boxes (event_hastag, event_livestreamed and event_format). Where can I make my own meta values default in those dropdowns?
|
|
Add this to the beginning of your custom templates:
For point two, see the documentation section under Adding default meta key/values for example code: Basically, you’d create a new function and place it in the theme’s functions.php file. |
|
I’ve added the code at the begining of the espresso_table.php file as you suggested and it didn’t work. Then I inserted the information in this section ( around line 56) by adding the $event_meta within those variables and nothing again.
I tried to compare looking at the code why those EE_meta codes are working in the registration_page.php versus the espresso_table.php but I can’t figure it out. Any suggestions? For point number 2, what I found out which is interesting is that the default values come from the functions.php file found in the following folder: includes/admin-files/ around line 332, and not from the code I added into my themes folder as documented in the https://eventespresso.com/wiki/shortcodes-template-variables/#ee-meta . This is the code found in the functions.php,
So to have my default key dropdowns and values, shouldn’t I place them in the functions.php found in /admin-files instead? |
|
For the espresso_table template, it would be a little different, around line 91 add:
If you edit core files directly (eg admin-files/functions.php) you’ll lose your changes when you update Event Espresso. Copy the entire function over to the custom_functions.php file in the custom files add-on. |
|
Question no. 2 is now OK. I’ve added the entire function in the custom_functions.php and it works fine. Although it’s nothing like the documentation said… For the first subject, using the $event_meta still doesn’t work, in fact the whole website crashed when I added that line (anywhere in the code)such as in this example:
If I were a programmer I would probably investigate more but since it’s not my cup of tea, I feel I keep running in circles. I also tried to apply what is said in the EE documentation but it’s not that clear so I haven’t found an easy way to add meta data in templates. |
|
I tested the code on my test site using the espresso_table.php template and it’s working fine. When you copy the code from the forum into the template file, does it appear like the example you posted, or the one I posted? Specifically, is it:
or
The first instance is correct, the second would most likely crash a site. |
|
I come up with the first instance, it’s the forum code which changes the signs. Maybe because my browser is in French… I tested with a clean version of the template and you are correct, the code works fine therefore it must be the way I am calling the meta code. I have it this way;
Note: I had to remove the signs before ?php and at the end so you could see this code
|
|
Josh, it works, there was most likely something corrupted in my template. Thanks for the support. |
|
The support post ‘EE_Meta not working in various templates & how to make dropdown EE_Meta values’ 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.