Support

Home Forums Event Espresso Premium Custom template pack and variations setup

Custom template pack and variations setup

Posted: June 8, 2017 at 11:57 am

Viewing 10 reply threads


CornellPump

June 8, 2017 at 11:57 am

Hi,
I’ve been going through the custom message template pack and variations documentation and am getting confused. I did download template pack example plugin and variations example plugin from github, and am working on modifying the code to meet our needs.

1. variations for the template pack – the documentation on registering a messages template variation talks about adding the code in “the main plugin file” – are you talking about the variations plugin, or the template pack plugin?

2. If I’ve already installed the template pack plugin, why can’t I modify its default CSS, instead of using another plugin and/or registering a variation within the template pack plugin to modify the message styles? (I’ve tried modifying the default css files provided int the variations folder within the template pack plugin, and they do not affect the messages).

Please tell me if what I am thinking I need to do to make any changes to the message templates (HTML and CSS) is correct:
1. Create a plugin for a new template pack to allow for a new set of HTML template files
2. Modify up to 86 individual template files with my own HTML structure and tag attributes
3. create another plugin to recognize CSS files for use with the new template pack
4. create or modify the CSS files needed
5. Go in the admin area for event esspresso>messages and for each message, switch to the new template pack and switch to the new variation


Josh

  • Support Staff

June 8, 2017 at 12:16 pm

Hi there,

The variations are for CSS options. So for example you can have one template, then select different CSS options for that template.

The template packs are for changing structure, including html, for the default templates.

Can you point to the language in the documentation where you need some clarification?


CornellPump

June 8, 2017 at 12:33 pm

In another support thread, when someone asked about modifying CSS for a template pack, the response was to check the documentation here: https://github.com/eventespresso/event-espresso-core/blob/master/docs/E–Messages-System/registering-message-template-variations.md
In the above documentation, it talks about setting up a variation.
so – questions not answered are, 1. if I have a new template pack, does it rely on the core default CSS or does it have its own CSS?
2. If I want to change CSS in my new template pack, does it have to be with a seperate plugin to create new variations?

Does this clarify? Thanks!


Josh

  • Support Staff

June 8, 2017 at 1:07 pm

That’s covered here:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/E–Messages-System/registering-message-template-packs.md#step-one–setup-the-template-pack-class

So even if you don’t have an extra variation you want to add to a new template pack, you still register the default variations. You can also add extra variations by registering new variations, and those new variations can be included in the same plugin as your template pack.


CornellPump

June 8, 2017 at 2:44 pm

Hi Josh,
The info is helpful but I am still unclear on a couple parts of this. Is there anything that covers setting up the default variation for a template pack? In looking over the code we have:

list the variations supported by the template pack: Nothing in the below code suggests designating a default variation and I am unclear as to if it matters where these variations are registered (in the same plugin / in a variations plugin).
$this->_variations = array();

Change the label used on the default variaton. (? the default variation in my admin still just says “default” after the plugin is loaded and the new template pack is selected):
$this->_default_variation_labels = array( ’email’ => __(‘New Pack Default’, ‘event_espresso’ ) );


Josh

  • Support Staff

June 8, 2017 at 3:14 pm

If you wish to override the default variations for your template pack, then you can do so by defining the variation CSS in the specific naming schema in your template pack’s variations folder. This indicates to the system that you wish to use defaults as defined by your template pack. You can see how we did this in the plugin example:

https://www.evernote.com/l/AATJGRRoxgdLVqjZTTRLCtRHweiu62oZ0H8

So for example if you have a /templates/variations/email_default_default.css file in your message pack, EE will use your default for email messages. Otherwise if it does not find that file in your message template pack plugin, it uses the default from the core plugin.


CornellPump

June 8, 2017 at 3:46 pm

Hi Josh, thanks for your quick replies. I do have a email_default_default.css in the template pack folder at /templates/variations/, and I did add css to this file that references classes used in the new templates, expecting it to work as you described above. However that CSS isn’t being picked up, so I assumed this was not the way to do this.

html from template file:
<h6 class=”collapse company”>[COMPANY]</h6>

css from email_default_default.css:
.company {color: #fff;}

In the wysisyg editor for the message, the template is loading and [COMPANY] shows white. when I do a test send, it reverts to the #444 color used in the original default file.


Josh

  • Support Staff

June 9, 2017 at 8:34 am

If you can compress your plugin into a zip file and upload it to a fileshare service, then link here (or even push to github) we can take a look at what you’ve got so far and investigate further.


CornellPump

June 9, 2017 at 9:06 am

Hi Josh, here is a link to the zipped plugin.
https://www.dropbox.com/s/lq2ydsc1ehlmtjo/EE-messages-template-pack%20-%20Cornell.zip?dl=0


Josh

  • Support Staff

June 12, 2017 at 8:55 pm

Thank you.

This took a bit of time to troubleshoot because there was more than one thing blocking the way. One is, the plugin folder name must not contain spaces. So instead of
EE-messages-template-pack - Cornell
it needs to be changed to something like
EE-messages-template-pack-Cornell. After you rename the plugin folder, you’ll need to go to the WordPress > Plugins screen and reload it. What happens is even though your web server is OK with the spaces in the filename, the web browser isn’t going to recognize a URL (to load the stylesheet) with spaces in it.

The other thing is the email_default_default.css file is incorrectly named in the mock add-on. The default email template should actually be named:
email_main_default.css.


CornellPump

June 21, 2017 at 1:11 pm

Hi Josh, I am testing this but running into some issues that need to be addressed before I can fully test this and will follow up on the threads I started for those.

Viewing 10 reply threads

The support post ‘Custom template pack and variations setup’ 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