Okay
  Public Ticket #3036183
Set a category as primary
Closed

Comments

  • mediastyledk started the conversation

    Hello

    Is it possible, if an event has more than a single category, to set one of them as primary? Just like when you create a post? Right now it seems like the primary category is just the first one in line I choose from the category list. It's basically because I want to view the events in the color of a specific category.

    Thanks

  •  877
    Zhivko replied

    Hi,

    No, there's no built-in option for this currently. I'll make sure to add this option in the next version.

    As a workaround I could write a script that will prioritize category colors but I'll need the ids of your primary categories.


    Stachethemes Developer

  • mediastyledk replied

    Hi,

    Thanks for your reply!

    It's alright, it was just in case I had missed something in the plugin, but great that you'll consider it for further development :)

    Actually, I have another question. In another ticket you helped me with inserting the day in a box as well as fetching the category color. The ticket is called "Single Event fetch category color". I was just thinking if it's possible to translate that string? Like from "Monday" to "Mandag"? I've tried using the gettext() function and seaching through WPML, but I didn't manage to find it. 

    Thanks in advance.

  •  877
    Zhivko replied

    You will have to make some changes to the script I've sent you earlier:

    // Attaches day name
    const dayOfweek = moment.tz(stecSingleEvent.start_date, stecSingleEvent.timezone)
        .add(stecSingleOptions.repeat_offset, 'seconds').day();
    const language = document.documentElement.lang;
    let dayLabelsArray = [];
    switch (language) {
        case 'da-DK':
            dayLabelsArray = ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag', ]
            break;
            // cases for any additional locales here if any
        default:
            dayLabelsArray = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', ]
    }
    const dayLabel = dayLabelsArray[dayOfweek];
    $('.stec-layout-single-day').before(dayLabel + ' ');
    



    Stachethemes Developer

  • mediastyledk replied

    Hello

    It almost works, it just keeps showing the day in english after the day - like "Thursday Thursday" and "Torsdag Thursday". I've done some trial and error in the code, but unfortunately didn't get that far.

  •  877
    Zhivko replied

    Yes, I noticed this too but I thought you've added it from somewhere else and didn't look further.

    I'll take a look in a moment.


    Stachethemes Developer

  •  877
    Zhivko replied

    There was a duplicate of the code in hello-elementor theme functions.php file.

    Should be ok now.


    Stachethemes Developer

  • mediastyledk replied

    Thank you so much!