Widgets are configurable elements used to dynamically build sections of a WordPress theme.

learn more… | top users | synonyms (1)

4
votes
2answers
5k views

check if registered sidebar is active & has widget content

I'd like to check if a registered sidebar has widget content - but can't seem to find a WP function for this - is_active_widget checks if it has content, but not if it exists or not. function ...
4
votes
2answers
6k views

How to edit widgets in WordPress

In the Appearance -> Widgets menu there is a list of widgets that you can drag and drop to show in the sidebar. Where is the HTML/PHP code for these custom widgets? I've been on WordPress's Function ...
4
votes
2answers
810 views

Call dynamic_sidebar but include/exclude named widgets?

Is it possible to include or exclude specific named widgets that are assigned to a named dynamic_sidebar call? For example, if I've registered a sidebar named "my_sidebar" and the user had placed a ...
4
votes
1answer
5k views

Adding iframe Content to Sidebar Widget

I'm trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe. I've tried using the "Text" widget and pasting ...
4
votes
2answers
2k views

Moving WordPress.com theme and widget settings to self-hosted site?

Possible Duplicate: Migrating from WordPress.com to self-hosted site and autoforward visitors? How can I move theme and plugin (widget) settings from a WordPress.com site to a self-hosted ...
4
votes
1answer
433 views

Enabling jquery when dragging available widget to sidebar area

So I have some widgets that are using some custom jquery on the backend. I can get the widget forms to call the jquery files but only AFTER I've saved the widget and reloaded the page. Is there ...
4
votes
3answers
2k views

Get page IDs based on which template they are using?

I have a situation where I need to provide a dropdown of pages in a widget, based on whether they are using a specific template. In other words, for all pages using template 'Foo', get the post ID. ...
4
votes
3answers
2k views

A plugin to show post tags in a widget

I'm looking to show the tags of a post within a widget. I know this is hard because it's outside of the loop, but has it been done, is there one available? Thanks for any assistance. Hudson
4
votes
2answers
2k views

How to add a filter to all widget output

Is there one last filter that is ran over the widgets before they are sent out to the browser? I would like to add a filter that adds rel="nofollow" to all links in all widgets. For instance, I can ...
4
votes
2answers
297 views

Can I display the widget admin in the page admin?

I would like to show the 'Appearance -> Widgets' menu underneath the text field in 'Pages -> new/edit'. Is it possible to take one part of the admin and show it elsewhere? Reading some of the ...
4
votes
3answers
1k views

Widget development - Drop down options won't save

So, i successfully managed to add a drop down option, the problem is when i click save all of the options are removed, however the chosen option is implemented successfully. Here is the relevant ...
4
votes
1answer
391 views

Using wp_category_checklist in a widget

I'm trying to use wp_category_checklist in a widget to display a list of checkboxes which, when saved, remain ticked. I'm having awful trouble at the moment getting them to save, as as far as I know ...
4
votes
2answers
2k views

Get sidebar parameters (before_widget, before_title, etc.) from within a widget

Is it possible to dynamically get sidebar parameters from within a widget? That is, I am trying to access the before_widget/after_widget/before_title/after_title/name parameters of the containing ...
4
votes
1answer
136 views

Storing custom dashboard widget options in wordpress

I am using the Codex example to build a custom widget. The specific example seems to be working fine until you click configure and change options values. After you click submit, changes are not saved. ...
4
votes
3answers
1k views

Has anyone managed to integrate the wp_editor inside a widget?

Adding this in the widget form method: wp_editor($text, $this->get_field_id('text')); seems to work. But after you press the "Save" button the widget goes funky... Adding ...
4
votes
1answer
535 views

Video Embed in Sidebar Widget with Links to Others in Category

I am trying to re-create the sidebar widget found here: http://www.clinicalforensicpsychology.org/ The links below the shown video are linked to the post category "videos". I have tried most every ...
3
votes
3answers
1k views

How to enqueue script if widget is displayed on page?

I created a widget that uses a jquery plugin, and I used is_active_widget to enqueue the script, it's working fine but it's also including the script even on pages that doesn't show this widget. so is ...
3
votes
3answers
7k views

How to add a specific widget to only 1 page?

I would like to show a widget in only one page of my site, as i can see it is not possible right? Should i add that for all my site pages or not?
3
votes
3answers
2k views

Get number of widgets in sidebar

How can I get the number of widgets that are active on a specific sidebar? Is there a core function for this? I want to add a class to each widget on a sidebar based on how many of them are ...
3
votes
2answers
2k views

Getting post-thumbnails from another WP site

I have two WordPress installations, one at http://inversekarma.in and the other at http://inversekarma.in/photos. The latter is a photoblog, and its theme uses the standard WP post thumbnails (EDIT: ...
3
votes
2answers
2k views

Is There A Hook To Process The Content Of The Text Widget?

Is there any filter which can be used in a plugin to process the content of the text widget before it is rendered?
3
votes
2answers
841 views

How To Determine If A Filter Is Called In A Sidebar/Widget Context?

So I have a plugin that appends or prepends an enhanced author biography to the content of a page/post/custom post type. It does this by hooking to either the_content or the_excerpt and ...
3
votes
2answers
643 views

Widget with random posts from a blog for external sites

How can I create a customizable widget with random posts from my blog that can be published on another site as js, iframe or div. Is there any Wordpress plugin for that?
3
votes
1answer
335 views

Loop through widgets in sidebar

I have a sidebar called footer, I know I can use dynamic_sidebar() but I need to be able to split that into individual widgets. I have the following so far which gives me the widget name e.g. text-1, ...
3
votes
1answer
2k views

Get a list of all Widgets registered in WordPress admin widgets-area

I'm trying to disable a couple standard widgets in my theme functions.php. Therefore I wrote this little function, which works well: function my_widget_ctrl() { ...
3
votes
1answer
209 views

Register multiple sidebars

I am registering my sidebars as follows: $sidebars = array ( 'sidebar-10' => 'Main Sidebar', 'sidebar-11' => 'Homepage Area One', 'sidebar-12' ...
3
votes
2answers
100 views

Delete Custom Dashboard Widgets

Here is the code on how to delete all dashboard widgets - the default, and plugin widgets but I want to change the code to only delete custom dashboard widgets not the default ones. // Create the ...
3
votes
1answer
450 views

Why will using __construct instead of widget_class_name when creating widget trigger out of memory error

I find that if I use class widget_name extends WP_Widget { function __construct() { ... } } instead of class widget_name extends WP_Widget { function widget_name() { ... } } I get an ...
3
votes
1answer
1k views

Switching themes without losing widgets?

The other day, I switched from 2010 default them to Semiologic, then back. When back to the 2010, all my appearance/widgets had gone back to the default. Does this often happen? What is the best ...
3
votes
1answer
451 views

Should I use set_transient or update_option?

I want to store some Twitter API data in WordPress. After every hour, I want to fetch new data from Twitter, and update only if the data is successfully retrieved from API (sometimes the API gives ...
3
votes
2answers
320 views

Add New Footer Widget Area with Limited Options?

I'm trying to add a new footer widget area to my theme. I was able to add the new footer widget area and it works correctly. But I would like to limit what can be done with the widget area by the end ...
3
votes
1answer
2k views

Add a custom walkter to a menu created in a widget

I know how to add a Walker to a custom menu created by the theme (menu named primary in this example), but how can I target a menu thats created in a widget with the default wordpress custom menu ...
3
votes
1answer
1k views

How to add author details in the post sidebar?

I would like to add author details in the sidebar instead of bottom of the post? Can anyone tell me how to do that? As of now i'm using like this in the loop <?php $curauthor = ...
3
votes
2answers
1k views

Override dynamic_sidebar() in plugin?

I'm writing a custom plugin that allows a particular page to have it's own sidebar with widgets. It works great so far, but what I'd like to do is generalize it more and allow the plugin to ...
3
votes
1answer
1k views

Widget to display custom taxonomy tag cloud

How to alter the default widget to display a tag cloud of a custom taxonomy?
3
votes
2answers
1k views

Copy widget settings from one blog to another

I am trying to hook 'wpmu_new_blog' in a plugin so I can copy the widget settings from one blog to the new blog that is being created. Does anyone know if there are WordPress functions to accomplish ...
3
votes
2answers
9k views

Disable Specific Widgets on Selected Pages of a WordPress Website?

I would like to give a CMS look to some of my pages. I want to customize them by removing the default widgets and adding other widgets as my wish (I will use plugins like My Custom Widget to add ...
3
votes
2answers
1k views

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

I am setting up a new WordPress blog and would like to include a widget in the content of a Page. I found some forums describing PHP hacks which appeared to apply to older versions. With WordPress ...
3
votes
1answer
78 views

How to update widget from widget() function?

I'm trying to create a simple linkroll widget for displaying recent https://pinboard.in links via their API. To maximize loading speed, I want to cache the linklist in a widget field, as well as the ...
3
votes
1answer
93 views

Programmatically edit the text of a widget

I have text widgets that contain text. I'd like to programmatically edit that text. Is there a way to do that?
3
votes
2answers
1k views

How to add color picker to widgets?

I have some problems adding the wpColorPicker to a Widget. Does anyone have a working sample? It only works when I click on 'Save' or reload the page, but when I drag a new widget to the area it will ...
3
votes
2answers
2k views

Need to create a Theme demo site that features multiple themes

I would like to create a site like: http://demo2.woothemes.com/?name=sentient for my clients, so that they can see the range of themes I offer. I own many templates from different providers, and ...
3
votes
1answer
2k views

How to use is_active_widget?

This is the manual page and this is the code. But I'm still struggling to understand how to use this function. Perhaps I am using it right, but something I can't think of is wrong. But more surely, I ...
3
votes
1answer
841 views

get_intermediate_image_sizes Get the Size Names but How Do I Get the Sizes?

I'm setting up a widget that allows to add an image to a sidebar / widget area. Basically I have a dropdown that allows the user to select one of the available sizes inside the theme's functions.php ...
3
votes
1answer
147 views

What is the use case for the “Class” parameter in register_sidebar?

I registered a new sidebar and filled in the class parameter (see code), I then dropped in an Archive widget and went hunting for my "testing" class. Not there. So what is the class parameter used ...
3
votes
1answer
745 views

What is this instance variable doing in the Widgets class

The lack of documentation for the WP_Widget class is driving me mad. Here is what I have salvaged off the codex: public function form($instance){ ?> <label for="<?php ...
3
votes
1answer
358 views

Determining a Widget Instance and Sidebar Location?

When using the filter: add_filter('widget_display_callback', 'function_name'); function function_name($instance) { /* Some Code */ return $instance; } Is it possible to determine the sidebar ...
3
votes
1answer
228 views

Add a select box to all widgets

I would like to add a default select box to all widgets placed in the sidebars of my site. This would allow to choose the color of the associated widget. Do you know how i can make this ? I know how ...
3
votes
1answer
468 views

Problems with the sidebar args and wp_list_bookmarks

I have run into an issue trying to use the sidebar args (before_widget,after widget,after_widget,before_widget) as theme style friendly parameters for the function wp_list_bookmarks, that is that the ...
3
votes
1answer
676 views

Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying

I am registering sidebars and sidebar widgets. The theme currently supports two sidebars. Primary and Secondary. add_action('widgets_init', array($this, 'add_sidebars'), 10, 2); public function ...