From ab30e19afd4e351c71f6b8868e42f3d6896cf4e2 Mon Sep 17 00:00:00 2001 From: Salman Date: Mon, 11 Aug 2014 09:49:43 -0400 Subject: [PATCH 1/3] Small stuff functions: remove unnecessary variable reg-sidebars: need widgets page --- functions.php | 4 +++- inc/reg-sidebars.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 3a233eb..c8930c7 100644 --- a/functions.php +++ b/functions.php @@ -172,13 +172,15 @@ function be_hidden_meta_boxes($hidden, $screen) { } -function load_custom_wp_admin_style() { +function load_custom_wp_admin_style($page) { 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' ); 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' ); From ba8fd576d480ae89100f9967fbe04d50f0b7df44 Mon Sep 17 00:00:00 2001 From: Salman Date: Mon, 11 Aug 2014 15:42:01 -0400 Subject: [PATCH 2/3] Hiding inactive home sidebars widgets-area.php: css to hide the sidebars in widgets page functions.php: enqueue css in widgets-area.php admin-style.js: hide containers of hidden sidebars in widgets page --- css/widgets-area.php | 22 ++++++++++++++++++++++ functions.php | 32 +++++++++++++------------------- js/admin-style.js | 10 ++++++++++ 3 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 css/widgets-area.php 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 c8930c7..75dcc00 100644 --- a/functions.php +++ b/functions.php @@ -172,30 +172,24 @@ function be_hidden_meta_boxes($hidden, $screen) { } -function load_custom_wp_admin_style($page) { - 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'); - +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( '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 widgets_page_css($hook) { } -add_action( 'widgets_init', 'remove_widgets' ); -*/ +add_action( 'admin_enqueue_scripts', 'widgets_page_css' ); add_theme_support( 'post-thumbnails' ); \ No newline at end of file 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 From 60004f96f0ac6b051f1308c4f59becdb2d16ba48 Mon Sep 17 00:00:00 2001 From: Salman Date: Mon, 11 Aug 2014 15:45:32 -0400 Subject: [PATCH 3/3] forgot to remove unnecessary function --- functions.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/functions.php b/functions.php index 75dcc00..571ef3b 100644 --- a/functions.php +++ b/functions.php @@ -187,9 +187,4 @@ function load_custom_wp_admin_style($hook) { } add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' ); -function widgets_page_css($hook) { - -} -add_action( 'admin_enqueue_scripts', 'widgets_page_css' ); - add_theme_support( 'post-thumbnails' ); \ No newline at end of file