Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Last active August 29, 2015 14:14
Show Gist options
  • Save JudeRosario/152eea75cb692dfdd6b6 to your computer and use it in GitHub Desktop.
Save JudeRosario/152eea75cb692dfdd6b6 to your computer and use it in GitHub Desktop.
CoursePress customize colors knob.js
add_action('wp_footer', 'custom_dial_colors', 100);
function custom_dial_colors() {
$script = <<< EOT
<script type="text/javascript">
jQuery(document).ready(function($) {
if ( $( ".knob" ).length ) {
jQuery(".knob").trigger(
'configure',
{
"fgColor":"#FFFFFF",
"bgColor":"#000000"
}
);
}
});
</script>
EOT;
echo $script;
}
// Special Thanks to Marko and Rheinard from WPMUDEV for this
add_filter( 'shortcode_atts_course_unit_details', 'change_knob_color', 10, 1 );
function change_knob_color ( $atts ) {
$fg_color = '#000000';
$bg_color = '#ffffff';
if ( isset( $atts['knob_fg_color'] ) ) {
$atts['knob_fg_color'] = $fg_color;
}
if ( isset( $out['knob_bg_color'] ) ) {
$atts['knob_bg_color'] = $bg_color;
}
return $atts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment