Support

Home Forums Event Espresso Premium Setting A Category As A Primary Category

Setting A Category As A Primary Category

Posted: May 21, 2018 at 8:21 am

Viewing 5 reply threads


Phil Evans

May 21, 2018 at 8:21 am

Hi,

Is there a way of setting an event that has multiple categories to have a primary category as you can with “standard” WordPress posts?

The reason I want to be able to do this is so that I can display events in our calendar with the the colours that have been assigned in categories. Currently it is taking on the colours of one of the other categories that are assigned to the event.

For example, this event has two categories

https://www.impactmh.org.uk/courses/you-programme-enrolment-dunstable-over-50s-for-september-2018/

They are:

– You Programme Sign-Up
– You Programme Over 50s Sign Up

On the calendar interface, it looks like the You Programme Sign-Up category colours are taking precedence

https://www.impactmh.org.uk/course-calendar/?event_category_id=you-programme-over-50s-sign-up#espresso_calendar – there is an event on August 28th, as an example. This should be green background.

Hope that makes sense.

Thanks

Phil


Seth Shoultes

  • Support Staff

May 21, 2018 at 9:18 am

Hi Phil,

You can show events from a specific category in the calendar by using a shortcode. Something like this: [ESPRESSO_CALENDAR event_category_id=your_category_id]

Just replace “your_category_id” with the category id you want displayed.

Does that help?


Phil Evans

May 21, 2018 at 9:44 am

Hi Seth,

The events from the category display OK by default. However as this particular one has two categories, I’m trying to force the colour coding of one particular category. In this case – You Programme Over 50s Sign Up should be green and not be using the brown colour coding of the other category that it uses – You Programme Sign-Up

https://screencast.com/t/aILY6Kw0GLlS

Thanks

Phil


Josh

  • Support Staff

May 21, 2018 at 2:36 pm

Hi Phil,

The only reliable way to override the background colour when there are two or more categories attached to an event is add CSS.

For example, you can add the following CSS to your site to set the green background to the events that have both You Programme Over 50s Sign Up & You Programme Sign-Up:

#espresso_calendar .you-programme-over-50s-sign-up {
background-color: #93d664 !important;
border-color: #93d664 !important;
}

If you do not have a custom stylesheet to add CSS to, you can add the CSS to the WordPress dashboard’s Appearance → Customize → Custom CSS panel.


Phil Evans

May 22, 2018 at 1:03 am

Thanks Josh,

That works a treat.

I have two CSS rules now as follows:

/* calendar category colours override */
#espresso_calendar .you-programme-over-50s-sign-up {
background-color: #93d664 !important;
border-color: #93d664 !important;
}

#espresso_calendar .you-programme-for-the-over-50s {
background-color: #93d664 !important;
border-color: #93d664 !important;
}

I tried to combine them as follows

/* calendar category colours override */
#espresso_calendar .you-programme-over-50s-sign-up, you-programme-for-the-over-50s. {
background-color: #93d664 !important;
border-color: #93d664 !important;
}

to try to make it a bit neater, but that didn’t work. Have I got the syntax wrong on the selectors?

Thanks

Phil


Phil Evans

May 22, 2018 at 1:08 am

Actually, Josh, I think I figured it out. I was missing the second id

/* calendar category colours override */
#espresso_calendar .you-programme-over-50s-sign-up,
#espresso_calendar .you-programme-for-the-over-50s {
background-color: #93d664 !important;
border-color: #93d664 !important;
}

Which works a treat. Thanks for your help.

Regards

Phil

Viewing 5 reply threads

The support post ‘Setting A Category As A Primary Category’ 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