Missing sidebar parameter “fix” – before_content

This code detects whether a title has been set, and if not, it changes the before_widget argument. add_filter( ‘widget_display_callback’, ‘wpse4213_widget_display_callback’, 10, 3 ); function wpse4213_widget_display_callback( $instance, $widget, $args ) { if ( empty( $instance[‘title’] ) ) { $args[‘before_widget’] = ‘<div class=”container”><div class=”content”>’; $widget->widget( $args, $instance ); return false; } return $instance; } This code works … Read more

How do you force a sidebar widget to have a container div around all child widgets?

Sidebar functionality doesn’t handle wrapping container, you need to add that on template level. Here is example markup of sidebar-primary.php template (taken from Hybrid theme and simplified a bit): if ( is_active_sidebar( ‘primary’ ) ) : ?> <div id=”primary” class=”sidebar aside”> <?php dynamic_sidebar( ‘primary’ ); ?> </div><!– #primary .aside –> <?php endif; ?> Also I … Read more

Problem with widgets

Most themes will have a default set of widgets that appear when you don’t add any widgets yourself (using the widget page in admin). You can normally just drag the widgets that were “hard-coded” into the correct sidebar, and all should be ok.

Can WordPress Read Its Own RSS Feed?

Better to use a query loop to show posts, which is a modifed version of the main WP loop. This query loop won’t interfere with the main WP loop and can be used mutiple times in a sidebar or post/page with php execution enabled. Use a php widget in your sidebar: WordPress › PHP Code … Read more

How to get “Widget Logic” plugin’s input value in a custom widget code (to display on the Widget admin page)

I’m almost sure there is no way to do that (server side) without hacking core files, bu luckly i know a little jQuery and i’ve come up with this hackish function that does the job just fine: function widget_logic_hack(){ global $pagenow; if ($pagenow == ‘widgets.php’){ ?> <script> function hack_logic(){ jQuery(‘input[id$=”widget_logic”]’).each(function() { if (jQuery(this).val().length === 0){}else{ … Read more