Modern Events Calendar - Title of Category Dropdown

Posted this here a few weeks ago but didn’t reply in time and the topic was closed so I can’t respond. Here’s my original issue: I’m using the MEC list view and am setting it up to filter by month by setting each month as a category. Is it possible to change the title of the Category dropdown? So rather than “Category” it would say “Filter by Month”? Looked through all of the settings and couldn’t find anything. Any help would be appreciated!

This is the code I was told to add:
jQuery(document).ready(function($){
$(’.search_cat option:first-child’).html(‘Filter by Month’);
});

Added the code and cleared my browser + X cache and it didn’t do anything. Here’s the website to give you an idea: https://taracannistraci.com/ – just scroll down to “upcoming shows”. The months are also showing up in alphabetical rather than numerical in the category dropdown. Would love to have a solution for that as well.

Any help is greatly appreciated and i’ll make sure to respond much quicker this time around :wink:

Hey Brandy,

Please try updating that code to this:

jQuery(document).ready(function($){
$('.mec-dropdown-search option:first-child').html('Filter by Month');
});

Please ensure that it’s added in Theme Options > JS.

If that does not work or if you wish to use a better method, install a child theme and add the following code in your child theme’s functions.php. The PHP method is better because the JS method is susceptible to breaking if there’s a third-party plugin or script that will output an Javascript error.

add_filter( 'gettext', 'mec_texts', 20, 3 );

function mec_texts( $translated_text, $text, $domain ) {

 
    switch ( $translated_text ) {

        case 'Category' :

            $translated_text = __( 'Filter by Month', 'mec' );
            break;

    }

    return $translated_text;
}

Hope that helps.

Used the child theme method and it worked great! Thanks so much! Is there any way to make the months (which are just categories) show up in a specified order? Right now it’s automatically showing in alphabetical order --ie:

August
July
September

Would like it to be:
July
August
September

  • additional months

Appreciate your help!

Hello Brandy,

Thanks for updating in!

Regretfully the months in the filter were displayed in alphabetical order by default hard coded in the theme. Changing it to use the date format will require modification of the plugin. Please be advised that custom modifications of this plugin is way beyond the scope of our support.

Thank you for you understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.