Posted: October 19, 2015 at 1:30 am
|
Hi, Just after some assistance with the following query if possible. I am using sub-categories to allocate different colours to individual events. This is ok however I can’t have the sub-categories displaying in the calendar dropdown. If I could please be directed to the code for displaying the category dropdown, so I can limit to show only top level parent categories, it would be greatly appreciated. Thank-you |
Hi Mark, The code that displays the category dropdown is in the calendar add-on’s EED_Espresso_Calendar.module.php file. I do not advise directly editing the file, and if you review the code you’ll note that it’s looping through all the taxonomy terms for event categories, which by the way are not hierarchical. What I would suggest instead of modifying that loop is add some jQuery to the calendar page that hides each of the categories from the dropdown. Something like this can be added to a functions plugin or into your WordPress theme’s functions.php file.
|
|
|
Thank-you very much josh, that’s perfect. I inserted the code into the child theme functions and it worked perfectly. Thanks again π |
Hi Mark, I’m glad that worked for you. If you need any further assistance just let us know π |
|
|
Hi Tony, Unfortunately it has stopped working. Not sure what prompted this, I have updated expresso and added a .mo file to change some strings? This is the php I have included in my child theme functions function my_remove_calendar_category_options() { This is the url it relates to http://ssa.marxdesign.com.au/youth-calendar/ Thank-you, your assistance is appreciated. |
Hmm, I can’t see any reason for that to stop working. It looks like you have disabled the category dropdown on the page above, if you’d like to test this on another page using the [ESPRESSO_CALENDAR] shortcode that isn’t set within your WP menu (and therefor away from view) we can view this on there. |
|
|
Thanks Tony, we have set up a test page http://ssa.marxdesign.com.au/test-calendar. I updated the code in functions.php to suit this page’s slug but unfortunately still not altering the categories in the dropdown. Any suggestions would be great. |
Hi Mark, I checked both of the pages you linked to and the script is not loading, at all, anywhere on either of those pages. It looks like your theme has a custom JS script, so maybe they recommend placing custom scripts within that file? Another alternative is you can put the script right within a little functions plugin. |
|
|
Hi Josh, thanks for the reply, I have tried adding the code in the custom JS of the theme and also creating a little functions plugin. Unfortunately I have been unable to get either of these options working. In the console the script returns SyntaxError: Unexpected token ‘?’ does it do the same on your end? |
I don’t see any errors within console, but I also can not find the JavaScript from above within the page. What method are you currently using? |
|
|
Thanks for the reply Tony, hmm that’s strange, I have the code added in a custom plugin as directed above, the php file contains the below code: function my_remove_calendar_category_options() { /* Stop Adding Functions */ |
Hi there Mark, Is this a site specific plugin? If so, could you ensure that it is activated through WP plugins? Also, please adjust your slug towards the beginning of the code snippet (i.e. change the underscore to a dash): test_calendar –> test-calendar — |
|
|
Thanks Lorenzo, the plugin is activated. I have corrected the slug and no difference unfortunately. |
|
Good news, i did a bit of further investigating and have been able to get it to work using .remove(); rather than .hide();. Thanks for your help everyone π |
The support post ‘Calendar – Limit Categories in Dropdown’ 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.