Support

Home Forums Event Espresso Premium Event Espresso 4 – Ticket custom CSS

Event Espresso 4 – Ticket custom CSS

Posted: April 23, 2015 at 7:09 am


actonaid

April 23, 2015 at 7:09 am

Hi there,

I’m trying to replace the current CSS files that the default ticket template is using. I am following this guide but I can’t seem to get it working (i’ve been at this for a few hours now!)

Here’s the code I’m using in a plugin:

<?php
/*
* Plugin Name: Custom Ticket Variation
* Plugin URI: http://actonaid.org.uk
* Description: This is to assign a new variation in event espresso for custom CSS on ticket template
* Version: 1.0
* Author: Peter Allen
* Author URI: http://peterallen.me
* License:
*/

/**
 * Regsiter custom CSS files for ticket template
 */
define( 'EE_NEW_VARIATION_TEST_VERSION', '1.0' );
define( 'EE_NEW_VARIATION_TEST_FILE', __FILE__ );
define( 'EE_NEW_VARIATIONS_PATH', plugin_dir_path( __FILE__ ) . 'variations/' );
define( 'EE_NEW_VARIATIONS_URL', plugin_dir_url( __FILE__ ) . 'variations/' );
 
function eea_custom_ticket_variation_load_textdomain() {
    load_plugin_textdomain( 'eea-custom-ticket-variation', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
}
add_action('plugins_loaded', 'eea_custom_ticket_variation_load_textdomain');
 
function regiser_eea_custom_ticket_variation() {
    if ( ! class_exists( 'EE_Register_Messages_Template_Variations' ) ) {
        return;
    }

    //setup variations array for all known message types.
    $message_types = array(
        'default'
        );
    $vtions = array();
    foreach ( $message_types as $message_type ) {
        $vtions[$message_type] = array(
            'main' => __('Main', 'eea-custom-ticket-variation' ),
        );
    }
 
    $variations_setup = array(
        'base_path' => EE_NEW_VARIATIONS_PATH,
        'base_url' => EE_NEW_VARIATIONS_URL,
        'variations' => array(
            'default' => array(
                'html' => array(
                    'ticketing' => $vtions
                )
            )
        )
    );

    EE_Register_Messages_Template_Variations::register( 'eea_custom_ticket_variation', $variations_setup );
}
add_action( 'EE_Brewing_Regular___messages_caf',  'regiser_eea_custom_ticket_variation' );

?>


actonaid

April 24, 2015 at 3:57 am

Hi there,

I have setup a new variation to replace the ‘default’ css files for a printable ticket. The new variation works fine and loads the new css files when previewing the ticket through the WordPress admin however when viewing the tickets through the link in the email sent to registered attendee’s, the variation files aren’t being loaded and I can’t see why. I have followed the Registering a Message Template Variation guide

The new variation is called ‘custom_ticket’ and I have one CSS file named ‘html_base_custom_ticket.css’.


actonaid

April 24, 2015 at 4:22 am

Also, here’s a “live ticket” (purchased through the registration checkout) that’s not loading the variation.

And this is how it should look (viewing through the preview button in the edit messages page of the admin).


Lorenzo Orlando Caum

  • Support Staff

April 27, 2015 at 4:22 pm

Hi, this isn’t something that I’m familiar with so I’ve asked a team member to share feedback here.

They’ll take a look and reply here with some information on how to get this working.

Thanks


Lorenzo

The support post ‘Event Espresso 4 – Ticket custom CSS’ 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