Add a select box to all widgets

Thanks to Ed Nailor & Kucrut ! http://ednailor.com/2011/01/24/adding-custom-css-classes-to-sidebar-widgets/ // __________________________________________________________ // // CUSTOM CLASS BY WIDGETS function kc_widget_form_extend( $instance, $widget ) { if ( !isset($instance[‘classes’]) ) $instance[‘classes’] = null; /* Set your predetermied class choices here */ $myarray = “class1,class2,class3”; $myclasses = explode(“,”,$myarray); $row = “\n”; $row .= “\tid_base}-{$widget->number}-classes’>Class:\n”; $row .= “\tid_base}[{$widget->number}][classes]’ id=’widget-{$widget->id_base}-{$widget->number}-classes’ class=”widefat”>\n”; foreach($myclasses … Read more

Display comment form of specific page in sidebar

Don’t build your own form and don’t modify comments.php – it’s purpose is little bit different and I don’t think you should include it inside sidebar. Just put comment_form function call in your sidebar template. It takes 2 parameters: args and post_id. So you can do it like this: $args = array( … // your … Read more

Unregistering a Sidebar in Child Theme

It should be possible to use the after_setup_theme hook to unregister the sidebar you don’t want like this: function go_away_extra_sidebar(){ unregister_sidebar( ‘Footer’ ); } add_action( ‘after_setup_theme’, ‘go_away_extra_sidebar’ ); Happy Coding, Kuchenundkakao

Check if has any sidebar active on current page

I believe the issue here is a problem with vernacular. is_active_sidebar isn’t page specific — just checks to see if it has data within it throughout the entire site. You are asking a different question. Sounds like you are asking “does this template reference and sidebars AND do any of those sidebars have data in … Read more

How to get the name and description of a sidebar in theme?

You can use the $wp_registered_sidebars global variable. Like this: global $wp_registered_sidebars; if( is_active_sidebar( ‘activity_calendar_en’ ) ): esc_html_e( $wp_registered_sidebars[‘activity_calendar_en’][‘name’] ); dynamic_sidebar( ‘activity_calendar_en’ ); endif; If you check the WordPress core for is_registered_sidebar function, you’ll see that it’s using this global variable too: function is_registered_sidebar( $sidebar_id ) { global $wp_registered_sidebars; return isset( $wp_registered_sidebars[ $sidebar_id ] ); } … Read more

Display tags for current post in sidebar

You can use get_the_tag_list(), you just need to set the 4th argument, $id to get_queried_object_id() which gets the ID of the main queried post/page outside of the loop. You’ll want to check is_singlar() too though, in case the queried object is a tag/category with the same ID as a post: <?php if ( is_singular() ) … Read more

Override dynamic_sidebar() in plugin?

dynamic_sidebar() calls wp_get_sidebars_widgets() to get the list of all sidebars and their widgets. This output is filtered through sidebars_widgets, so you can modify it to add or remove widgets. This array only contains widget IDs, so you need to register the widget instance too (it should end up in the global $wp_registered_widgets array). I think … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)