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

learn more… | top users | synonyms (2)

5
votes
3answers
14k 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?
5
votes
2answers
9k 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 ...
5
votes
4answers
4k 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 displayed....
5
votes
1answer
101 views

can require “themefolder/includes/widgets.php” in “themefolder/functions.php” yet widgets.php doesn't run

In order to keep things clean I use functions.php almost solely to require other files. As such part of functions.php looks like this: #include types require("includes/types.php"); #include ...
5
votes
1answer
830 views

Highlight custom widgets in the admin area?

I have created some custom widgets for my client to use, but I want to make them stand out amidst the fifteen or so standard widgets in the admin area. How can I do this? I have solved this problem ...
5
votes
1answer
167 views

Add filter to blogroll widget

I'm trying to add <i class="icon-ok"></i> before the content inside the <li> of the blogroll widget. I'm assuming that's done through the link_title filter, but I can't find a ...
5
votes
1answer
2k 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 ...
5
votes
1answer
684 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 ...
5
votes
2answers
821 views

Complex widget form UI - examples and best practices

I'm contemplating a widget with quite a number of options, which will make for a lengthy widget form. To improve the user experience with this form, I'd like to divide it into sections. I don't feel ...
5
votes
1answer
2k views

How to hide or remove unwanted widgets on Multisite installation?

I am using Multi-site installation. I don't want all the widgets appear under widgets.php on dashboard .So I tried to find a way to remove or hide unnecessary widgets . SO that the new sub-sites ...
5
votes
2answers
309 views

Having different sidebar content for MANY pages?

I am continuing on from a topic I already posted but with a different angle. Please bare with me as I try to provide as much information as possible. I am looking to add a simple text area called "...
5
votes
1answer
989 views

How to use wp_dequeue_style() for style enqueued in WP_Widget class

I've got a plugin that makes a widget that enqueues some front-end CSS to style the widdget. I call wp_enqueue_style from the public widget() method in the extended WP_Widget class: <?php class ...
5
votes
2answers
8k views

How to override the wordpress default widget markup

I am new to wordpress, Here i use the wordpress TwentyEleven theme, i need to customize the widget markup. It means the suppose i want to change the element 'ul' to div and add some class or id to ...
5
votes
1answer
237 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 ...
5
votes
2answers
207 views

Prevent widgets removal

I'm building a site with a lot of widgets. They have been highly customized. Several admins/editors will have to edit these widgets when the site is live. Right now I'm scared to see a widget (and ...
5
votes
1answer
190 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. ...
5
votes
3answers
155 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.
5
votes
2answers
4k 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 ...
5
votes
2answers
4k views

How can I get $id variable in widget's form function?

How can I get $id variable in widget's form function? According to widget's structure I see that widget function have $args as a parameter, which will be extracted in function's body. In my case i ...
5
votes
6answers
13k views

How can I add links to widget titles?

I'm using three widgets, two of them are default WP widgets (Recent Posts and Archives) and the third one is a custom widget which acts like Recent Posts but for a specific custom Post Type. My ...
4
votes
5answers
4k views

Different widgets on different page templates?

If I have a couple of different Page templates, how would I show a different collection of sidebar widgets for each of these templates? I'm using the Starkers theme as a starting point.
4
votes
2answers
3k 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?
4
votes
2answers
1k 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 appending/...
4
votes
1answer
829 views

Register multiple sidebars

I am registering my sidebars as follows: $sidebars = array ( 'sidebar-10' => 'Main Sidebar', 'sidebar-11' => 'Homepage Area One', 'sidebar-12' ...
4
votes
1answer
8k 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

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 ...
4
votes
3answers
4k 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
2answers
10k views

Where is the content of widgets stored in mysql table

I have the cPanel access to a website but no wordpress login info. So I wants to change a widget content in the website. How can I change it through phpmyadmin. Where are that widgets sidebar data ...
4
votes
5answers
3k views

Sharing Dynamic Sidebars across Multisite Blogs

I'm trying to find away to retrive a dynamic sidebar from one blog and print it on another blog in the same install of Wordpress Multisite. I have tried switch_to_blog($blog_id); dynamic_sidebar($...
4
votes
1answer
2k 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 = ...
4
votes
2answers
4k 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
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 ...
4
votes
1answer
3k 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 ...
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
2k views

Widget to display custom taxonomy tag cloud

How to alter the default widget to display a tag cloud of a custom taxonomy?
4
votes
1answer
88 views

Updating to Version 4.5 bumped my “main sidebar” widget out of place

I updated to the newest version of word press and it changed my home screen. Essentially it shifted my text to the right and as a result shifted my "main sidebar" widget downward to now begin below ...
4
votes
1answer
1k views

Get Widget Instance inside Widget

I'm trying to access the $instance variable from a custom function I've written inside my Widget, but I keep getting a "variable is undefined" error. How can I re-create the $instance variable? ...
4
votes
2answers
694 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 answers,...
4
votes
1answer
10k views

Use Media upload in custom widget on wordpress 3.5

I'm creating a small widget for wordpress 3.5 that allows you to upload images. The widget is loaded correctly by wordpress. When I add the widget to a sidebar upload button does not work. If I ...
4
votes
2answers
4k views

How do i manually place a widget code

is there a way that i can place a certain widget any where on the site. For example: I'm using the text widget in my sidebar, for the title i put youtube, and i placed the youtube embed code in it. ...
4
votes
3answers
2k 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 _WP_Editors::...
4
votes
1answer
557 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
2answers
1k views

Remove before_widget / after_widget content from Wp_Widget_Text

I want to take the text widget and remove the preceding / trailing markup from the text output currently showing as <div class="textwidget">Test</div> The before_widget / after_widget ...
3
votes
4answers
16k views

How do register_sidebar() and get_sidebar() work together?

Disclaimer: I am brand spanking new to WP. I am using the Starkers HTML5 framework theme. In the functions.php I see this code: function starkers_widgets_init() { // Area 1, located at the top ...
3
votes
2answers
3k 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
3answers
247 views

link wordpress and stackoverflow

how do i link stackoverflow widget in wordpress to my profile in stackoverflow to show badges, reputaions ??
3
votes
1answer
1k 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
3answers
4k views

HowTo: Add Class to Sidebar Widget List-Items

The newest version of Bootstrap (v3.0) adds a new List Group component which has the following structure: <ul class="list-group"> <li class="list-group-item">Cras justo odio</li> ...
3
votes
2answers
379 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
3answers
12k views

Woocommerce Product Category Widget - hide categories that have no products in stock [closed]

I'm using WooCommerce on my Wordpress site, and have a widget in the sidebar showing all product categories. It's setup to hide empty categories, and that works well. However, it still shows ...