Sidebars are stored in global variable $wp_registered_sidebars
. You can get the sidebar properties using this variable.
global $wp_registered_sidebars;
if ( isset( $wp_registered_sidebars['sidebar-2'] ) ) {
echo $wp_registered_sidebars['sidebar-2']['name'];
}
Note that do not use it too early, either on/after
widgets_init
hook
or in a template file.
Related Posts:
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- One button to change all settings in theme customizer?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- Design view breaking on Pages
- Widgets not showing in my custom theme
- Can’t load WP function into external function
- Set WordPress Default Template
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- How do I link a button I created in theme customizer to a function?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- get_template_directory adding FTP root folders in urls
- Show different website layout if no sidebar added
- How can I assign separate stylesheets to different pages?
- How to make sure relative URL works when site is not on root domain?
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- Menu to the right of screen on desktop using Bootstrap 4
- Function to return true if current page has child pages
- Proper use of Output Buffer
- List of all theme customizer control types?
- Is having multiple theme customizers for different pages possible?
- How to export/import theme customizer settings?
- function_exists call in function.php
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Debugging an error: wp_enqueue_style was called incorrectly
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- Remove css styles from specific page
- Use different javascript files for each page on website
- How to get custom image size for image uploaded in Customizer
- WordPress menu deletes when trying to add a hook
- Get widget settings function?
- How do I list the_tags() into HTML data-attribute
- How the functions in WP are called in tags
- What is the fastest way to load PHP functions that are only used in one theme template?
- My Own layout in WooCommerce pages [closed]
- Differences when using the the_time and the_date functions
- Add a Second Menu to a theme that only support 1 menu
- Changing the template hierarchy
- Trigger popup in a php if/else statement
- Customizer: Output default value in Customizer CSS
- WordPress does not load page.php, return 404.php
- How to put a variable in a instance in the widget
- Converting HTML Template to WordPress Theme
- WordPress add post format support not working
- How to remove the cufon script from Dzonia Lite theme [closed]
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Populate editor with some content of a page with a page template
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Adding a widget function into the php theme file
- How to edit widget code to add unique class name to each div?
- Skt full width basic slideshow problem
- Trying to retrieve post meta
- WordPress admin-ajax.php
- Use .php file as page instead of wordpress page & template file?
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Separation of presentation and code – WordPress
- How to call multiple functions from multiple files into a WordPress page template [closed]
- What is the best way to define constant options for a theme?
- Warning: printf(): Too few arguments in helpers.php file
- How to make function appear in sentence?
- Widgets not showing on custom theme
- My website is not showing Footer section
- blank white page when post/update/change option etc
- How to Update an old theme for the latest wordpress version
- get_comments_number() returns 0
- get_page_templates only return templates with “home” in the filename
- How to get post category list as select in front-end?
- Why in this WordPress theme I can’t see the Main Menu?
- Displaying Slider in Front Page (home) using Customizr Theme
- Need advice on theme customizer and child themes
- call a string/function from database
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- How a HTML form can trigger a PHP function?
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- remove_action from parent theme using child theme functions.php
- How to use data URL in WordPress?
- How can I prevent a shortcode div from extending beyond its boundaries?
- Unable to retrieve get_author_posts_url
- How to override theme’s public static function inside of a trait?
- WordPress child theme, creating a custom php template page
- is_user_logged_in() not working in homepage
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- Calling PHP function doesn’t work in index.php
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- WordPress get_post_meta issue
- List sibling pages widget, exclude current page
- Using existing widget code! [closed]
- How to add button to top of theme customizer?
- Adding php within a return statement [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Predefine Magazine Style Layouts
- How can I fix my pagination?
- How to store the_post_thumbnail() value in a variable
- a problem in class in class-wp-hook.php
- Font Awesome Icons as squares [closed]