How to set colours programmatically for the Super Speedy Colour Filters

We provide an interface for you to set the colour filters, but perhaps you have thousands of colours and you have a file of some kind for these mappings.

In that case, we have provided a filter you can use to change the colour hex programmatically.

One thing to note: In the filter, we use the Americanised spelling of the word colour, i.e. color.

add_filter('ssf_change_color_hex', 'override_ssf_color_hex', 10, 3);
function override_ssf_color_hex($colorhex, $term_id, $taxonomy) {
// change your colours here based on term_id and taxonomy
return $colourhex;
}

Inside the colour filter, you have access to whatever colour hex you set in our interface (or else it will be empty if you did not set it).

You also get the $term_id and $taxonomy, e.g. pa_color typically in these cases.

Add whatever code you like here to map your term_ids to your colour hexes.

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo