• Resolved Pat K

    (@blackcapdesign)


    This is a very nifty plugin! I have a client who loves the color coded categories but isn’t keen on the 0.25 opacity for inactive categories. I know it’s dead easy to adjust the opacity value to 0 in the legend-superpowers.js file – but I’d rather do this in a way that won’t be overwritten each time there’s a plugin update. I tried creating a template override:
    wp-content/theme-name/teccc/legend-superpowers.js
    but it’s being ignored. I’ve tried clearing my cache and appending the URL with
    “?refresh_css” to no avail.

    Is there a way to change the opacity value other than changing it in the plugin?

    Thanks!
    pk

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Andy Fragen

    (@afragen)

    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

    Plugin Author Andy Fragen

    (@afragen)

    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 6 years, 4 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

    Plugin Author Andy Fragen

    (@afragen)

    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 6 years, 4 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

    Plugin Author Andy Fragen

    (@afragen)

    Excellent! Glad you figured it out. I would still likely put it in a plugin as themes can change. ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Legend Superpowers Opacity’ is closed to new replies.