Support

Home Forums Event Espresso Premium Creating pages for categories/customising shortcode template

Creating pages for categories/customising shortcode template

Posted: August 26, 2014 at 3:37 am


Kyle Nel

August 26, 2014 at 3:37 am

Hi Folks, I have been working with the system over the weekend and am very impressed with its capabilities and design.

I am struggling to get my head around the best way to display each of my categories on it’s own page. I can’t find the category archives if they exist and I can’t figure out how to customise the category shortcode template if I add this to a page instead.

Either way I would just like to find out how to customise the template for my category pages. I can do this in my child theme already for the main events page so if you can help me with the category archives that would be great.

If you suggest the shortcode is better than how can I customise the way the events are displayed by the shortcode?

Kindest Regards
Kyle


Dean

August 26, 2014 at 4:12 am

Hi Kyle,

EE4 events are custom posts types so by default the archive is held at
http://www.your-site-name-goes-here.com/events/

If you are using any alternative event system (plugin or theme) that also uses a custom post type called events then ours may not show up. We have a guide here that will allow you to rename the custom post type slug to avoid conflicts. http://eventespresso.com/wiki/change-events-cpt-slug/

Category listings can be added to a page by using the following shortcode:

[ESPRESSO_EVENTS category_slug=”xxxxxx”]

where xxxxx is the category slug. Further parameters can be found in the Help & Support menu in the plugin itself.

The events can be customised via CSS or via templates or both.

One easy way to style X category different to Y category is to use the css_class=”my-custom-class” for the [ESPRESSO_EVENTS] shortcode, and then style those classes differently.


Kyle Nel

August 26, 2014 at 6:13 am

Hi Dean,

Thank you for that. I have it all worked out now. I changed the slug as suggested to ‘courses’. That is working great for the main event archive and also the single event pages but the category slugs are still in the format below:

http://www.your-site-name-goes-here.com/event-category/category-slug/

Any suggestions?

Thanks


Dean

August 26, 2014 at 6:26 am

Hi,

Not 100% sure what you mean as the event categories shouldn’t have an archive, unless paired with the ESPRESSO_EVENTS shortcode.

Can you provide a real example link?


Kyle Nel

August 26, 2014 at 6:55 am

Hi Dean,

I have no idea what I have done then. Here is the link to one of the category pages:

http://preview.illustratemedia.co.uk/flm/event-category/fitness-courses/

here is the main event page:

http://preview.illustratemedia.co.uk/flm/courses/

You will need a username and password as it is under maintenance at the minute.

* redacted *

  • This reply was modified 5 years, 2 months ago by  Josh. Reason: Removed log in credentials


Josh

  • Support Staff

August 26, 2014 at 8:03 am

Hi Kyle,

It says invalid username. You can send working creds via this form and we can take a look:

http://eventespresso.com/send-login-details/


Josh

  • Support Staff

August 26, 2014 at 9:40 am

Hi Kyle,

Is this what you’re looking to do? Instead of the event category archive having a base url of event-category, you want it to have course-category?

If so, you can add the following to your child theme’s functions.php file, save, then go to your WP Permalinks settings page to flush the rewrite rules.

function cpc_custom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'event-category' => 'course-category',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'cpc_custom_filter_gettext', 10, 3 );


Kyle Nel

August 26, 2014 at 10:02 am

Josh you are a genius. Thank you very much for your help.

One final request for the moment. I would like to use the category description in my template but I can’t find any mention of how in the documentation.

Could you point out what I need to use?

Thanks again.


Josh

  • Support Staff

August 26, 2014 at 12:40 pm

Hi Kyle,

You’ll want to check the WP Codex for this sort of thing. You can use term_description() and if this is a general archive template it’d be good to wrap the description in a is_tax() check.

Some example code follows:

< ?php if ( is_category() ) : single_cat_title(); elseif ( is_tax( 'espresso_event_categories' ) ) : echo 'The category description is...'; echo term_description( '', 'espresso_event_categories' ); // more elsif's if this is a general archive template endif; ?>


Kyle Nel

August 27, 2014 at 2:42 am

Thank you once again, I realise now what you mean when you say you use core wordpress functionality for EE4.

If there is anyone in charge who you can pass on my appreciation for all the help you have provided then please do so.

Enjoy your day.

The support post ‘Creating pages for categories/customising shortcode template’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Kyle Nel 5 years, 2 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.