diff --git a/css/widgets-area.php b/css/widgets-area.php new file mode 100644 index 0000000..8ca618a --- /dev/null +++ b/css/widgets-area.php @@ -0,0 +1,22 @@ + $index ){ + $index = $i; //$index is the biggest home widget area that has widgets, the next widget area doesn't have widgets + } + } + } + $start = ++$index; + for ($i=$start; $i < 31; $i++) { + echo '#home'.$i.'{ display:none; } '; + } +?> \ No newline at end of file diff --git a/functions.php b/functions.php index 3a233eb..571ef3b 100644 --- a/functions.php +++ b/functions.php @@ -172,28 +172,19 @@ function be_hidden_meta_boxes($hidden, $screen) { } -function load_custom_wp_admin_style() { - wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' ); - wp_enqueue_style( 'custom_wp_admin_css' ); - - - wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js', false, '1.0.0'); - wp_enqueue_script('uc-admin-js'); -} -add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' ); - -/* -function remove_widgets() { - // removed to avoid confusion with UConn Calendar widget - unregister_widget('WP_Widget_Calendar'); - // removed to de-emphasize blog use - unregister_widget('WP_Widget_Recent_Comments'); - unregister_widget('WP_Widget_Meta'); - // removed for conflict with simple social plugin on IE9 - unregister_widget('WP_Widget_Categories'); +function load_custom_wp_admin_style($hook) { + wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' ); + wp_enqueue_style( 'custom_wp_admin_css' ); + + + wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js', false, '1.0.0'); + wp_enqueue_script('uc-admin-js'); + if( 'widgets.php' != $hook ) + return; + wp_register_style( 'css-widgets-area', get_template_directory_uri().'/css/widgets-area.php' ); + wp_enqueue_style( 'css-widgets-area' ); } -add_action( 'widgets_init', 'remove_widgets' ); -*/ +add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' ); add_theme_support( 'post-thumbnails' ); \ No newline at end of file diff --git a/inc/reg-sidebars.php b/inc/reg-sidebars.php index 03cb911..8aad820 100644 --- a/inc/reg-sidebars.php +++ b/inc/reg-sidebars.php @@ -91,7 +91,7 @@ */ function uc_options_add_page() { add_theme_page( 'Manage Sidebars', 'Manage Sidebars', 'edit_theme_options', 'uc_sidebars', 'uc_sidebars_do_page' ); - remove_submenu_page( 'themes.php', 'widgets.php' ); + //remove_submenu_page( 'themes.php', 'widgets.php' ); } add_action( 'admin_menu', 'uc_options_add_page' ); diff --git a/js/admin-style.js b/js/admin-style.js index ecca6bb..6687358 100644 --- a/js/admin-style.js +++ b/js/admin-style.js @@ -2,4 +2,14 @@ jQuery(document).ready(function($) { $('#accordion-section-layout_builder .ui-slider-handle').each(function(){ $(this).addClass('button button-primary'); }); + + var path = window.location.pathname; + if( path.split('/').indexOf('widgets.php') != -1 ){ + $('.widgets-holder-wrap.sidebar-sidebar').each(function(i){ + if( !($(this['children'][0]).is(":visible")) ){ + $(this).css('display', 'none'); + } + }); + } + }); \ No newline at end of file