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

learn more… | top users | synonyms (1)

4
votes
3answers
1k 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
1answer
72 views

Why is the $old_instance needed for the widget update function?

In the PHPdoc of the function WP_Widget::update() located under wp-includes/widgets.php it says the following: /** * ... * This function should check that $new_instance is set correctly. * The ...
4
votes
2answers
179 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
1answer
873 views

Adding Widget form fields dynamically

I am trying to add form field to a WordPress widget dynamically. So if the user want to add another date to an event they can click a button to get more fields. The question is: How do save newly ...
4
votes
3answers
937 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
244 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
124 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
519 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 ...
4
votes
1answer
87 views

Prevent second widget activation

Is there a way to "remove the widget from available widgets" after you've activated it once on some area? The idea is to allow user to activate only one instance of it.
3
votes
3answers
5k 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
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
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
4k 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 ...
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
1k 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
1answer
691 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 ...
3
votes
1answer
902 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
2answers
95 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
2answers
671 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
1answer
418 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
366 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
303 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
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
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
8k 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
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
750 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
131 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
2answers
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. ...
3
votes
1answer
523 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
264 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
215 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
459 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
528 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 ...
3
votes
1answer
2k views

How Can I Duplicate a Widget?

By duplicate, I don't me copy the code from a (core) widget and change it a bit. That's pretty easy. I want the push button ability to grab all the settings from a given widget, copy them, stick them ...
3
votes
1answer
189 views

How to use jQuery on widget admin page

I have a lengthy form config for my widget so I thought about using radio buttons to hide and show the relevant input fields instead of having them all after each other. But it doesn't seem to work. I ...
3
votes
1answer
601 views

Help adding image upload functionality to widget

I am working on a small WordPress widget and I am trying to set it up where the user can upload an image. So far, the necessary scripts are loading but when I click the "Media Library Image" button ...
3
votes
1answer
152 views

Using preg_replace to clean widget output HTML

I am working on a wordpress site that uses a plugin / sidebar widget. The issue I am experiencing is that the widget generates HTML that is not valid, an example of this is below... <p> ...
3
votes
1answer
60 views

When to use which plugin output method?

I'm a Drupal dev, getting into Wordpress. So far as I can tell there are a few different methods by which a plugin can output content on to a Wordpress site: Shortcode Rewrite API Widget API ...
3
votes
1answer
762 views

Manual display of widget

I currently have a widget that needs to be manually displayed on the front page. The rest of the pages it shows up in the widget sidebar, (this is accomplished with 'Widget Logic') but on the front ...