What is the best way to include a widget in a Page?

This plugin might be the easy way. http://wordpress.org/extend/plugins/add-widgets-to-page/ But for a scratch method… Look into Theme Twenty-Ten’s functions.php file and find where the dynamic sidebars are registered. It looks like this: <?php function twentyten_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar( array( ‘name’ => __( ‘Primary Widget Area’, ‘twentyten’ ), … Read more

Copy widget settings from one blog to another

I don’t think there is anything specifically for this. You might want to look at the plugin code to find calls to get_option() and see what keys they are using, then browse the DB table wp_options with phpMyAdmin (or whatever) and grab the associated values. Without specific support from the plugin this can be iffy … Read more

Bookshelf plugin and/or widget [closed]

There are quite a few plugins tagged books in official repository. A lot of them seems to pull covers from services like Amazon, which may or may not fit your needs. If you want to simply display some self-hosted images with links and basic categorizing/sorting, personally I like to use Links for such.

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

How to create a widgetized sidebar for every category dynamically?

Not a good thing if you have a lot of categories, so be careful! First, add the following function in functions.php: add_action( ‘widgets_init’, ‘generate_widget_areas’ ); function generate_widget_areas() { //Do not create for uncategorized category $terms = get_categories(‘exclude=1&hide_empty=0’); foreach ($terms as $term) { register_sidebar( array( ‘name’ => ‘Category ‘.$term->name, ‘id’ => $term->slug.’-widget-area’, ‘description’ => ‘Widget area … Read more

Add class to before_widget for all widgets with a dropdown and a counter

The CSS classes are applied in the function dynamic_sidebar(). There is no specific filter for that: // Substitute HTML id and class attributes into before_widget $classname_ = ”; foreach ( (array) $wp_registered_widgets[$id][‘classname’] as $cn ) { if ( is_string($cn) ) $classname_ .= ‘_’ . $cn; elseif ( is_object($cn) ) $classname_ .= ‘_’ . get_class($cn); } … Read more

Disable default WordPress widgets in sidebar

This function will disable all widgets: add_filter( ‘sidebars_widgets’, ‘wpse134172_disable_all_widgets’ ); function wpse134172_disable_all_widgets( $sidebars_widgets ) { if (true == true) { $sidebars_widgets = array( false ); } return $sidebars_widgets; } Now the true=true conditional will disable them all the time, while you only want this to happen with a clean install. So you will have to … Read more

How can I whitelist only specific shortcodes for processing in text widgets?

add_filter( ‘widget_text’, ‘wpse_137725_shortcode_whitelist’ ); /** * Apply only whitelisted shortcode to content. * * @link http://wordpress.stackexchange.com/q/137725/1685 * * @param string $text * @return string */ function wpse_137725_shortcode_whitelist( $text ) { static $whitelist = array( ‘gallery’, ‘form’, ); global $shortcode_tags; // Store original copy of registered tags. $_shortcode_tags = $shortcode_tags; // Remove any tags not in … Read more