post_type !== AHA_HERO_SLIDER_CPT ) { return; } wp_register_style( 'aha-hero-slider-cpt-columns', false, array(), AHA_HERO_SLIDER_VERSION ); wp_enqueue_style( 'aha-hero-slider-cpt-columns' ); wp_add_inline_style( 'aha-hero-slider-cpt-columns', '.column-aha_hero_thumb{width:96px;}' ); } /** * Enqueue settings page scripts. * * @param string $hook Current admin page hook. * @return void */ public function enqueue_settings_scripts( $hook ) { if ( 'toplevel_page_' . AHA_HERO_SLIDER_ADMIN_SLUG !== $hook ) { return; } wp_register_script( 'aha-hero-slider-settings', false, array(), AHA_HERO_SLIDER_VERSION, true ); wp_enqueue_script( 'aha-hero-slider-settings' ); $inline_script = "(function(){"; $inline_script .= "var chk=document.getElementById('aha_hs_overlay_enabled');var box=document.getElementById('aha_hs_overlay_options');"; $inline_script .= "if(chk&&box){chk.addEventListener('change',function(){box.classList.toggle('aha-hero-overlay-options--hidden',!this.checked);});}"; $inline_script .= "document.querySelectorAll('.aha-hero-slider-shortcode-input').forEach(function(el){el.addEventListener('click',function(){this.select();});});"; $inline_script .= "})();"; wp_add_inline_script( 'aha-hero-slider-settings', $inline_script ); } }