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

learn more… | top users | synonyms (1)

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
2answers
419 views

Create More Widget Holders Like Active Widgets and Inactive Widgets

I am wondering if it is possible to create other Widget Holding sections like Active Widgets and Inactive Widgets. For instance, perhaps I would create a Media Widgets section and place all media ...
3
votes
2answers
168 views

How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?

I added the following to my functions.php: add_action('pre_get_posts', 'keyl_get_emp_posts'); function keyl_get_emp_posts($query) { if ($query->is_main_query()) ...
3
votes
1answer
275 views

Sidebar Widget Registration without a name, how is it assigned to new named sidebar widget?

In my current theme version, I'm registering sidebars with names. However, in previous versions, I only had one sidebar and registered it without a name like so... if ( ...
3
votes
2answers
746 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 ...
2
votes
5answers
5k views

Including Custom Post Types in “Recent Posts” Widget

I'm able to easily include my custom post types into my main loop by making small adjustments with query_posts(), but I'm not sure how I would go about including custom post types in the "Recent ...
2
votes
3answers
349 views

Why use widgets?

I am very new to using WordPress and I was wondering what the benefits of using widgets is? Looking here it sounds like they are for people who are not programmers that want to add plugins to their ...
2
votes
3answers
1k views

How to add a description to Widgets?

The codex doesn't seem to say how one would go about adding a description to a custom widget registered with wp_register_sidebar_widget(). The default description seems to be the name of teh widget ...
2
votes
2answers
650 views

What is the most efficient method for loading widgets in functions.php

I have seen WordPress developers use two different methods for loading custom widgets from the functions.php file. The first: include("functions/my-custom-widget.php"); The second: ...
2
votes
2answers
3k views

Give Editor Access To Sidebar

I want to give the Editor Role access to editing the sidebar and it's contents. I have a text widget in there and in order to edit this text widget the user needs to be an admin - this sucks. How do I ...
2
votes
3answers
190 views

link wordpress and stackoverflow

how do i link stackoverflow widget in wordpress to my profile in stackoverflow to show badges, reputaions ??
2
votes
1answer
650 views

register_sidebar ignores 'id' and 'class'

I am using the following to register a widget area: if ( function_exists('register_sidebar') ) register_sidebar( array( 'name' => __( 'Footer Widgets', 'hex'), 'id' => ...
2
votes
1answer
633 views

Custom shortcode in widget forced to top of widget

A custom shortcode i made is being forced to the top of the widget outside of the widget container. Any ideas why? This is my code... function nktmediaplayer_func($atts) { ...
2
votes
2answers
488 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?
2
votes
1answer
96 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, ...
2
votes
1answer
130 views

register sidebars

i registered my sidebars as follows: $sidebars = array ( 'sidebar-10' => 'Hoof Sidebar', 'sidebar-11' => 'Tuisbladsy area een', 'sidebar-12' ...
2
votes
2answers
220 views

How to delete cached transients from a widget instance properly?

So I have created this widget which pulls a number of posts. And the query is being cached via transients. But I need the transient to be deleted whenever a post is saved so the query can be ...
2
votes
1answer
261 views

How to use control_callback when creating a widget via functions.php or plugin?

I've created a dashboard widget in my functions.php file. I want to have it be able to update some stuff in the database upon form submittal. According to the codex documentation, I should be ...
2
votes
2answers
276 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 ...
2
votes
3answers
1k views

Role that can edit only widgets, not other theme options

How could I make particular role access widgets administration menu (wp-admin/widgets.php), but not access other theme administration menu elements. I have got that far as to display Appearance menu ...
2
votes
2answers
986 views

How wp_cache is supposed to work, and does it help with performance?

I was coding my recent comments widget, and using $wpdb->get_results and I wanted t use cache so it doesn't perform the query every time the page loads, so I used: $comments = ...
2
votes
1answer
1k views

How to limit wp_get_archives to show months for the X years only

Can anybody show me how to set a limit on wp_get_archives to show archives by month BUT only those for the year 2010 and above - so the 2009 monthly archives are not shown on the sidebar archive ...
2
votes
3answers
880 views

How to determine the current widget's parent container (sidebar widget id)

I have several custom widgets that are installed as part of my theme. I'd like to execute conditional code inside each widget's admin panel (not the public side, I'm just interested in the admin panel ...
2
votes
1answer
336 views

Creating your own widgets: using cache?

I'm in the process of making my own widget but I don't like it to fully generate the content each time since the process is quite lenghty. I can easily create my own caching mechanism but I'm ...
2
votes
1answer
329 views

Schedule cron event from widget

Can I use wp_schedule_event() to set up a cron job from within a widget? I tried, but I can't make it work, The problem seems to be the $hook parameter. The function I'm trying to hook is located ...
2
votes
3answers
181 views

Why can't I add this feed to the RSS widget?

I wish to use the following RSS in my widget, but it seems to not pick it up: http://www.tapuz.co.il/blog/rssBlog.asp?FolderName=TickTack I imagine there is a problem in the feed. So: What is it? ...
2
votes
1answer
38 views

List sidebars on a page

I need to generate a list of sidebars on a given page. I know how to list all sidebars that have been registered, and all sidebars that have been registered that have active widgets, but I do not know ...
2
votes
1answer
1k 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 ...
2
votes
2answers
2k views

Where to find the source code of a widget?

i would like to find the source code of the widgets, would you know where to find them? I found the class WP_Widget, but i would like to find, for example, the widget with the last articles. Thanks
2
votes
1answer
336 views

Widget Options Not saving

I am trying to create a custom Recent Posts widget that accepts a category, to show only posts in that category. I'm having trouble saving the widget options. I've done some debugging and found that ...
2
votes
2answers
1k views

Wordpress multiple widget in single plugin

In my plugin in need to create two widget. One is :social rank" another is "Profile Rank". This is the code which i am using here. <?php add_action( 'widgets_init', 'src_load_widgets' ); ...
2
votes
2answers
81 views

Detect if a plugin was included in a certain page

I´m developing a theme that include plugins. One of this plugins is a contact form. And this plugin have an asociate code to validate input data. Because I don´t know in what pages contact form was ...
2
votes
2answers
250 views

Separate backend “Widgets” page for each language

Im currently trying to make my backend work with multiple languages. Im using qTranslate as my translation plugin. So far I have accomplished a custom option page with multi-language support. When ...
2
votes
3answers
524 views

Use wp_enqueue_style based on user option in widget

I currently developing wordpress widget for my website. This widget will pull user latest post in my website and show in their blog. In the widget there is option for user to use their css or my css ...
2
votes
1answer
1k 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 ...
2
votes
3answers
393 views

wordpress widget textbox in the sidebar

I have a normal textbox widget that I am using in certain sidebars. The text widget generates a div within a ul. Is there anyway to make the widget generate another ul li instead? ...
2
votes
1answer
739 views

WordPress Widget multiple use

I created this widget using a simple example on WordPress Codex: <?php function widget_container_latest_posts() { global $wpdb; global $post; ...
2
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?
2
votes
2answers
1k views

Bookshelf plugin and/or widget

I'm looking for some kind of plugin and/or widget to display a list of book covers in the sidebar. Are there any good options out there?
2
votes
3answers
7k views

Which tabs widget plugin for wordpress is better?

I see there are a lot of plugins to create tabbed widget in side-bar: Fun with tabs Post 2 tabs Hybrid Tabs Wordpress Tabs Slides AmR Tab Menu Navigation Tabbed Widgets Which one is the best in ...
2
votes
1answer
1k views

Changing name of sidebar widget

I have created dynamic sidebars. They are working fine and appear in the Widgets area. However, I would like to customize the name that appears on each sidebar. So, right now each sidebar is named ...
2
votes
1answer
912 views

Enabling Widgets By Default in Custom Theme Development

In WP theme building, if a sidebar is not active, can I turn it on? Also, if the sidebar is active, and doesn't contain any widgets, can I add some? I'm a theme and plugin developer, but this is ...
2
votes
1answer
692 views

How to include checkbox in widget backend form?

I'm trying to include a checkbox in my widget back end. But I cannot get the value (on or off) after the user submits it. I thought the value would be stored in "esc_attr( $check )" (as it is when ...
2
votes
2answers
178 views

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

Some predefined widgets offer the option to use a select element (dropdown) and/or a counter after each entry. How can I add the CSS classes widget-with-dropdown or widget-with-counters to these ...
2
votes
2answers
208 views

Different rss feeds in a single dashboard widget

I am using this snip of code to get rss feed on my dashboard as widget. It becomes problematic when it displays 5-6 different rss feeds which makes me run down deep. How can I add 6 different feeds ...
2
votes
2answers
328 views

Reorder dashboard widgets

I recently tried to reorder the dashboard widgets by writing a plugin. I accomplished this: with the following code: <?php /* * Plugin Name: Custom Dashboard * Description: Custom dashboard ...
2
votes
1answer
301 views

Make compatible custom menu widget for Twitter Bootstrap

If I configure wp_nav_menu function, I can put the "items_wrap" option to achieve a nice navigation given by Twitter Bootstrap, thus: <ul class="nav nav-pills">%3$s</ul>. But, how to ...
2
votes
1answer
380 views

How To Add an Extra Field in All WordPress Available Widgets?

I keep searching on how to add an extra field on every WordPress available widget, something like Subtitle after the widget's Title. Is there a way to hook on every available widget?
2
votes
1answer
63 views

Query for recent images across multiple posts

I'm a bit fresh to wordpress theme development (and PHP in general), and I'm curious if there is a way to query XX number of recent images, likely spanning across multiple posts. Basically I want to ...
2
votes
1answer
136 views

How does the default recent posts widget work with cache?

I am trying to build a widget based on the default wordpress recent posts widget. In wp-includes/default-widget.php , I noticed in class WP_Widget_Recent_Posts in function widget(), the recent posts ...