function cherry_register_sidebars() { cherry_register_sidebar(array('id' => 'sidebar-main', 'name' => __('Main Sidebar', 'cherry'), 'description' => __('This is the main sidebar if you are using a two or three column site layout option.', 'cherry'))); cherry_register_sidebar(array('id' => 'sidebar-secondary', 'name' => __('Secondary Sidebar', 'cherry'), 'description' => __('This is the secondary sidebar if you are using a three column site layout option.', 'cherry'))); cherry_register_sidebar(array('id' => 'sidebar-header', 'name' => __('Header Sidebar', 'cherry'), 'description' => __('A sidebar located in the header of the site.', 'cherry'))); cherry_register_sidebar(array('id' => 'sidebar-footer-1', 'name' => __('Footer Sidebar 1', 'cherry'), 'description' => __('A sidebar located in the footer of the site.', 'cherry'))); cherry_register_sidebar(array('id' => 'sidebar-footer-2', 'name' => __('Footer Sidebar 2', 'cherry'), 'description' => __('A sidebar located in the footer of the site.', 'cherry'))); cherry_register_sidebar(array('id' => 'sidebar-footer-3', 'name' => __('Footer Sidebar 3', 'cherry'), 'description' => __('A sidebar located in the footer of the site.', 'cherry'))); }
/** * Custom sidebar item render. * * @return void */ function add_custom_sidebar() { check_ajax_referer('new_custom_sidebar', 'security'); $nonce = isset($_GET['security']) ? $_GET['security'] : $security; if (!wp_verify_nonce($nonce, 'new_custom_sidebar')) { exit; } global $wp_registered_sidebars; $Cherry_Custom_Sidebars_Methods = new Cherry_Custom_Sidebars_Methods(); $cusotm_sidebar_array = $Cherry_Custom_Sidebars_Methods->get_custom_sidebar_array(); $form_data = isset($_GET['formdata']) ? $_GET['formdata'] : $formdata; if (!array_key_exists('cherry-sidebar-manager-counter', $cusotm_sidebar_array)) { $cusotm_sidebar_array['cherry-sidebar-manager-counter'] = 0; } else { $cusotm_sidebar_array['cherry-sidebar-manager-counter'] += 1; } $id = $cusotm_sidebar_array['cherry-sidebar-manager-counter']; $args = array('name' => $form_data[0]['value'], 'id' => 'cherry-sidebar-manager-' . $id, 'description' => $form_data[1]['value'], 'dynamic-sidebar' => true); $registrate_custom_sidebar = cherry_register_sidebar($args); $cusotm_sidebar_array['cherry-sidebar-manager-' . $id] = $wp_registered_sidebars[$registrate_custom_sidebar]; ?> <div class="widgets-holder-wrap closed cherry-widgets-holder-wrap"> <div class='cherry-delete-sidebar-manager'> <div class="cherry-spinner-wordpress spinner-wordpress-type-1"><span class="cherry-inner-circle"></span></div> <span class="dashicons dashicons-trash"></span> </div> <div id="<?php echo esc_attr('cherry-sidebar-manager-' . $id); ?> " class="widgets-sortables ui-sortable cherry-sidebar-manager"> <div class="sidebar-name"> <div class="sidebar-name-arrow"><br></div> <h3><?php echo esc_html($form_data[0]['value']); ?> <span class="spinner"></span></h3> </div> <div class="sidebar-description"> <p class="description"><?php echo esc_html($form_data[1]['value']); ?> </p> </div> </div> </div> <?php $Cherry_Custom_Sidebars_Methods->set_custom_sidebar_array($cusotm_sidebar_array); wp_die(); }
/** * Rwegister sidabar for shop pages * * @since 1.0.0 * @return void */ public function register_shop_sidebar() { if (function_exists('cherry_register_sidebar')) { cherry_register_sidebar(array('id' => $this->shop_sidebar_id, 'name' => __('Shop Sidebar', 'cherry-wcoocommerce-package'), 'description' => __('Main Shop Sidebar', 'cherry-wcoocommerce-package'), 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>')); } }