Is there a way to dump all registered sidebar/widget?
There is, in fact! The global variable $wp_registered_sidebars stores the registered sidebars, and $wp_registered_widgets stores all registered widgets (by widget ID).
There is, in fact! The global variable $wp_registered_sidebars stores the registered sidebars, and $wp_registered_widgets stores all registered widgets (by widget ID).
You can include the search form in your 404.php file using the get_search_form() function. Using get_sidebar( ‘404’ ); would look for a file called sidebar-404.php and fall back on sidebar.php if needed. get_sidebar()
It’s in your theme or setup as a sidebar on the Widgets page.
In the ThemeHall Omega theme, the call to get_sidebar is wrapped in a function called omega_primary_sidebar. This can be found in hooks.php lines 180 to 185. This function then gets hooked to the omega_after_main action hook on line 35 and 36 in the same file
Traditionally, sidebars were implemented as lists. Each sidebar “box” is an LI, so the sidebar as a whole would need to be inside a UL tag. However, this is entirely a choice on the part of the theme author. The register_sidebar call can override the before_widget and after_widget parameters to be divs or anything else … Read more
I think your idea is really nice here, but you have a couple of serious flaws in your code. Never use extract(), ever. It is extremely hard to debug and can render unexpected output. It has now been completely removed from core, except in one instance as far as I can pick up from this … Read more
You should make the check inside the widget class, unless you don’t have a choice. The example in the codex is pretty much what you’re looking for: class cbs_map_widget extends WP_Widget{ function cbs_map_widget(){ $this->WP_Widget(‘cbsmaps’, __(‘Widget Name’), array(‘classname’ => ‘cbsmaps’, ‘description’ => __(‘whatever’))); … add_action(‘wp_enqueue_scripts’, array(&$this, ‘js’)); } function js(){ if ( is_active_widget(false, false, $this->id_base, true) … Read more
get_post() returns a post object. So you can try the following $post = get_post( 1571 ); setup_postdata( $post ); the_title(); the_content(); wp_reset_postdata();
Use the array_filter() function, which will remove every array element that has false as the value. Then you can count the array length. So your example would look like this: $sidebars = array( is_active_sidebar( ‘footer-4’ ), is_active_sidebar( ‘footer-3’ ), is_active_sidebar( ‘footer-2’ ), is_active_sidebar( ‘footer-1’ ), ); $active_sidebars = array_filter($sidebars); echo ‘col-‘.count($active_sidebars);
I have this post and the response from David Chu to thank for enlightening me. There is nothing patently ‘wrong’ with the way that I implemented this. The reason that it doesn’t work is because of the fact that I have both the Genesis Simple Sidebars plugin and the Genesis Woocommerce Connect plugin installed. Both … Read more