Posted: May 23, 2017 at 5:00 pm
|
Hi, I have EE4 and one thing I can’t seem to find information on is whether I can make a custom single event view template. I want a different template for certain types of events to control what is shown to potential registrants. Is this possible? I see info on this with EE3, but EE4 seems to steer everything to global css. |
Hi there, Global CSS? With EE4 events are a custom post types and the output is controlled via your theme. So generally speaking the output for a single event will be done using You can take over the output specifically for EE events by creating your own
For info on the templates that load take a look here: |
|
|
re: “global CSS” – not an official term; just in reference to what I found about customizing event views for EE4 by using a copy of the espresso_default.css file and making changes that affect all events. (IE when looking for ways to not show the pricing, the suggested option is to do this with CSS). |
Is it purely CSS changes your looking to make? Creating a page template purely for CSS changes is overkill really, it can work, but you can just include the CSS within either a child themes styles.css file or use a custom CSS plugin |
|
|
Tony, |
|
Any ideas/suggestions on this welcome, please. |
An idea/suggestion you might consider from the documentation: |
|
|
Hi Josh, There might be a way to apply that idea. Thanks; I had looked all through the documentation and missed that. I would still need a separate template with probably some javascript to change the text I want to change though, right? |
I do not think you need a separate template with some JavaScript to change the text. The text that you want to change can be changed by using a filter hook, similar to the example I shared with you. In fact, in that example you can add additional code within the conditional such as:
Note that the above will change the button text whenever there’s a free ticket included within the event, so you may prefer to handle that another way. |
|
|
OK- thank you! I think this will be much easier. |
|
Hi Josh, I added the filter that you suggested for the button text change and it is changing the text for all events, not just free ones. |
Did you wrap the code in a conditional, like I earlier mentioned? You’ll need to wrap the code in a conditional or it will apply to all events. |
|
|
Hi Josh, I did do a conditional but it appears to not be working right. I’m a novice in PHP (esp. wordpress-specific coding). here is the code: function format_reserve_button($amount, $reserve_button){ add_filter( ‘FHEE__EEH_Template__format_currency__amount’, ‘convert_zero_to_free’, 10, 2 ); add_filter( ‘FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text’, ‘format_reserve_button’, 10,2); |
|
I think I am reading the use of the $amount variable wrong; I’m going to work on this a bit and get back to you. |
The $amount variable doesn’t actually get passed to the You can replace the above with something like this instead: https://gist.github.com/joshfeck/150850af75a79932c533aec061868260 |
|
|
That worked perfectly. thank you. |
The support post ‘templates?’ 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.