I don’t really know how to filter the value in the JS. If you know how to filter the JS variable I’d happily add the filter. You can submit a PR on GitHub.
If your client doesn’t want to see the other categories, turn off Legend Superpowers. It will revert to the default Events Calendar behavior of a breadcrumbs page with only those events.
Without any method of passing in the opacity via some filter I don’t have a lot of other suggestions.
Thread Starter
Pat K
(@blackcapdesign)
Thanks Andy. I played around with dequeueing, deregistering then enqueueing a modified script but the plugin doesn’t enqueue the js, so I don’t think this method will work either. For now I’ll modify the value in the plugin’s legend-superpowers.js file. Maybe someone else will have an idea one how this might be achieved…
Thanks for sharing your awesome plugin!
pk
The script is absolutely enqueued.
wp_enqueue_script( 'legend_superpowers', TECCC_RESOURCES . '/legend-superpowers.js', array( 'jquery' ), Main::$version, true );
You should try using wp_dequeue_script( 'legend_superpowers' ); and then register/enqueue your modified script.
If you need me to split the enqueuing into a register then an enqueue to make it work let me know.
-
This reply was modified 7 years, 9 months ago by
Andy Fragen.
Thread Starter
Pat K
(@blackcapdesign)
Thanks Andy. I did a search for wp_enqueue_scripts (typo), not wp_enqueue_script. Apologies! I’ll take another stab at it and will report back.
pk
Sounds good. Let me know.
Personally, I would create a Category Colors Options plugin and add the dequeue/enqueue code in there. It keeps the organization easier.
BTW, here’s the plugin I wrote for my extra stuff. 😉
https://github.com/afragen/category-colors-options
-
This reply was modified 7 years, 9 months ago by
Andy Fragen.
Thread Starter
Pat K
(@blackcapdesign)
Success! Thanks again Andy. The script that I tried earlier was SO close. I was attempting to dequeue ‘legend-superpowers’ instead of ‘legend_superpowers’.
For anyone else who’s interested (in changing the opacity of filtered ‘inactive’ categories), simply make a copy of legend-superpowers.js and place it in your child theme: theme-name/tribe-events/teccc/legend-superpowers.js
…change the opacity value on line 17(ish) to 0
and pop the following in your child theme’s functions.php file:
// change opacity of filtered inactive categories
define( 'MY_CHILD_URI', get_stylesheet_directory_uri().'/' );
add_action('wp_enqueue_scripts', 'mytheme_scripts');
function mytheme_scripts() {
wp_dequeue_script( 'legend_superpowers' );
wp_deregister_script( 'legend_superpowers' );
wp_enqueue_script( 'legend_superpowers', MY_CHILD_URI . 'tribe-events/teccc/legend-superpowers.js', array('jquery'), '', true );
}
Cheers,
pk
Excellent! Glad you figured it out. I would still likely put it in a plugin as themes can change. 😉