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

learn more… | top users | synonyms (2)

2
votes
2answers
971 views

Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its ...
2
votes
1answer
318 views

Adding a widget programmatically

I want to add widgets to my wordpress site programmatically. I tried the following code from the codex docs: class MyNewWidget extends WP_Widget { function MyNewWidget() { // Instantiate ...
2
votes
1answer
593 views

Using tabs in admin widgets [closed]

Update: I should point out that I tested the method below on Plugin/theme options page and it worked perfectly. In-fact I was also able to include the jQuery cookie Plugin to preserve the current tab ...
2
votes
1answer
389 views

Custom Menus, Widgets & Conditional Statements

I'm employing custom widgets for my client because it's easy and they have several menus they need to create specific to site sections. I then want to allow them to add to the custom menu dynamically ...
2
votes
2answers
1k views

How to pass custom options from widget form to widget update callback?

I've added a few checkbox options to the default widget form. But I'm stuck on how to access these option states and pass them along during the widget save event (widget_update_callback) so that they ...
2
votes
2answers
1k views

Add custom post types stats to a custom dashboard widget

I have a lot of custom post types and I have them showing in my "Right Now" Dashboard but it's gotten pretty long so I want to separate them to a custom widget within the dash. See example below: ...
2
votes
2answers
274 views

How do I use the control callback when creating a simple dashboard plugin

On this page: http://codex.wordpress.org/Function_Reference/wp_add_dashboard_widget The function wp_add_dashboard_widget is described. It states: wp_add_dashboard_widget($widget_id, $widget_name, ...
2
votes
1answer
535 views

More flexible sidebar and widget management

I’d like to have a plugin for a flexible sidebar/widget management. In fact, I want to give a user the possibility to choose which sidebar should be displayed per page/post. I know there are many ...
2
votes
1answer
296 views

Count widgets of a certain type

How can I get the number (count) of, let's say, text widgets from a sidebar? for eg. if I drop 4 text widgets in the sidebar, I want to get this number somehow from another widget
2
votes
1answer
110 views

How to enable “shift-click to edit this widget” functionality on a custom widget?

I have created several custom widgets, modeled from the default widgets' code. The widgets all work fine, and I've been using them in production for awhile. I've been working with the new Customizer ...
2
votes
1answer
61 views

Insert Widget option into mark-up with register_sidebar

I have added a custom field to my all widgets in my theme, called "custom-title". I have managed to save the field into the database for each widget, like so: s:12:"custom-title";s:17:"HELLO TEST ...
2
votes
1answer
154 views

Multisite Widget/Content

I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not ...
2
votes
1answer
48 views

Why won't my custom widget stay in the sidebar after a reload?

After I drag my custom widget into a widget area and reload the page it's gone. Any ideas? <?php add_action('widgets_init','register_postTypeWidget'); function register_postTypeWidget(){ ...
2
votes
1answer
141 views

Trying to wrap <span> around first word of multiple word strings with a widget_title() filter, only works on two word strings and not more than two

I am trying to wrap a around the first word of multiple word widget titles. I have used the answer from here: ...
2
votes
2answers
224 views

javaScript in <head> section of WP API

How do I place the following javaScript in the <head> section of the Wordpress Widgets API menu screen? <script type="text/javascript"> jQuery(window).load(function() { ...
2
votes
2answers
482 views

How do I rebind event after widget save

I am writing a widget who's form elements have a click event attached to. I bind it using jQuery. However, after clicking save, the bindings gets lost. That is, clicking those elements doesn't ...
2
votes
1answer
79 views

add widgets to dashboard for easy access for clients?

I have a widget created: if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Featured Video', 'before_widget' => '', 'after_widget' => '', ...
2
votes
2answers
2k views

Customizing Default Categories Widget

I am trying to hack the default categories widget from wordpress. I have the categories displaying the way I want but I am having trouble editing the output. The widget shows the number of posts in ...
2
votes
1answer
580 views

wp_count_posts, wp_count_terms and wp_count_comments for specific user?

Is there a way for the functions wp_count_posts, wp_count_terms and wp_count_comments to return their results only for a specific user, possibly by using a user's ID? I'm making a custom "Right Now" ...
2
votes
2answers
484 views

Widgets not expanding on wordpress 3.3 widget dashbord

I updated to WordPress 3.3 (manual update) and cleaned browser cache. Widgets dashbord stop working when tring to expand dynamic sidebars for custom theme when it works for previous wordpress 3.2 ...
2
votes
3answers
1k views

How do I create a widget that only allows a single instance?

How do I create a widget that only allows a single instance of a widget to be added through the Wordpress interface? The default behaviour of widgets allows multiple instances to be added. I am ...
2
votes
1answer
1k views

Include custom post types in categories widget

So I got a fairly simple setup, one CPT with the default category and post_tag as taxonomies. Say I have 1 post and 1 CPT entry assigned to the same category. I need this to be reflected inside the ...
2
votes
0answers
94 views

Insert widgets after theme installation [duplicate]

Possible Duplicate: Install widget on plugin activation Programmatically add widgets to sidebars I'm creating a theme and after the installation it is need put the widgets. Exists any way ...
2
votes
1answer
317 views

How to determine if post has widget content?

I've got a registered sidebar called "my-header" that affects the absolute positioning of elements below it in the markup. So I need to execute a query in header.php to determine if the sidebar is ...
2
votes
2answers
1k views

How to automatically register widgets on new blog?

Is there a way to automatically register widgets when a new site is registered with a multi site setup? E.g. inside wpmu_new_blog?
1
vote
3answers
12k 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 ...
1
vote
2answers
166 views

How to put Stack Exchange Flair as widget?

I want to put my flair in as a widget in the top of my sidebar in my blog. There was a similar question asked here but the only answer links to the flair page and suggests copying and pasting the html ...
1
vote
5answers
213 views

Dynamic widgets

In wordpress is it possible to have different widgets on different pages, I mean, I am having a form widget which has to be just displayed on posts page, it should just display on single.php Is this ...
1
vote
3answers
193 views

Replace dashboard widgets with banner ad

I know it's probably not encouraged, but is there a way to replace the standard dashboard widgets (Recent Drafts, Quickpress, etc.) with a standard image banner ad? I know how to add new dashboard ...
1
vote
2answers
3k views

$post>ID displays wrong post ID

I've asked a question about listing all sub-pages before: Listing all sub-pages? But all the questions were wrong. Anyways, I have now simpler question. global $post; echo $post>ID Works ...
1
vote
2answers
857 views

How can I add an incremental class identifier to my sidebar widgets?

My sidebar widget code in functions.php looks like this... if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Home Sidebar', 'id' => 'home-sidebar-widget', ...
1
vote
3answers
2k views

Why Can't wp_editor Be Used in a Custom Widget?

I've been working on developing a plugin that adds a widget that allows you to edit the content with a wysiwyg editor. I want to use the default wordpress editor by calling wp_editor(). I've seen ...
1
vote
2answers
919 views

Using Ajax call in jQuery doesn't work in widget

So I'm in the midst of creating a new conversion widget and I'm having some trouble getting the Ajax call to work in my widget. (works perfectly outside of WordPress). The problem at the moment is ...
1
vote
2answers
1k views

cannot drag and drop widgets since wordpress 3.2.1

I recently updated my site to wordpress 3.2.1 automatically. Now I tried to manage my sidebar widgets, and noticed I can no longer drag and drop the widgets around. If I look into my browser-console, ...
1
vote
4answers
2k views

Completely disabling widgets

How do I completely remove widget support from a theme/plugin ? Like removing the appearance -> widgets page, and prevent WP from loading widget classes and all widget-related stuff.
1
vote
1answer
2k views

Remove/Add widgets from/to the Available Widgets pool

Is it possible to remove/add widgets from/to the Available Widgets pool (either by plugin or editing core files)? There are 3 widget files located at: /wp-includes/widgets.php /wp-admin/widgets.php ...
1
vote
1answer
2k views

Calling the widget id of a mult-instance widget from inside the widget?

I'm trying to output a unique widget ID inside my mult-instance widgets. So far the following hasn't worked. Is there a unique ID and how do I call it? Thanks. function widget($args, $instance) { // ...
1
vote
1answer
2k views

Is there plugin to show recent posts from one website in the widget area of another?

I would like to take the titles of recent posts or content related posts from one website and display them in the widget area of another website. I'm sure there must be a way to do this, perhaps some ...
1
vote
3answers
3k views

Adding custom html and standard widgets to sidebar

I want to add both custom html that advanced text widgets can't support and the standard sidebar widgets in the same sidebar. However, when I put a sidebar widget into the theme, it removes all the ...
1
vote
3answers
925 views

Dynamic Sidebars On Multiple Subpages

I am building a site in WordPress. It has multiple subpages, many of which require different sidebars. So, I have a widgetized theme and I have also created a few sidebar widgets. I have written a ...
1
vote
4answers
3k views

How do I stop a widget from displaying on mobile site?

On my main site I have used the search widget in the sidebar. However, the mobile theme I am using (minileven) already has a search box built into its menu bar. This results in a second search box ...
1
vote
2answers
4k views

How to add the widgets manually to the sidebar?

How can I add the widget manually in the code ?
1
vote
2answers
2k views

WordPress “include TEMPLATEPATH” or?

I built something like this: Index Container Widgets Area and I created a widget for that - Categories Widget - Index Container .php with this in: <?php include (TEMPLATEPATH . ...
1
vote
2answers
4k views

How to hack recent comments default widget?

I would like to hack the default Recent Comments widget to show also the avatar of commenter. The modification should be really easy, if I change directly the code in default-widgets.php if ( ...
1
vote
2answers
397 views

Inserting shortcode [stream /] into a Text widget

hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it. <?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 ...
1
vote
4answers
823 views

How Can A Widget With Only One Instance Be Defined?

How can a widget which of which only one instance can be used?
1
vote
1answer
7k views

Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?

Before asking question here I want to tell that I have already asked the question in stackoverflow and wordpress forum but have not got any answer. So finally I came here. I have installed the ...
1
vote
1answer
696 views

Why are my widgets not saving when being added to a sidebar?

The following is in my function.php file. I see the sidebar in my Appearance > Widgets page but whenever I drag something on over the sidebar and save it just disappears once I leave the admin ...
1
vote
4answers
110 views

Displaying a widget only on long posts (over X characters)

I'm looking to display a standard wordpress widget only on posts that are over X amount of characters in length (or another method that can roughly calculate the height of of a post.) I am looking to ...
1
vote
2answers
2k views

Retrieving list of a custom post type in a widget without using WP_Query?

I'm using the following widget to retrieve a list of the custom post type jobs: class FeaturedJobsWidget extends WP_Widget { function FeaturedJobsWidget() { $widget_ops = array('classname' ...