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

learn more… | top users | synonyms (2)

3
votes
1answer
677 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
3answers
347 views

How do I save data from submitted form from widget

I'm looking over internet for some simple solution of email subscription widget but no luck. Or they are too complicated and paid, or they are relaying on some external email functions. I'm not a ...
3
votes
1answer
3k 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
203 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
676 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
158 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
62 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
849 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 ...
3
votes
1answer
1k views

Using the media uploader in a custom plugin

As part as a widget I'm creating, I need the admin to upload an image via the widgets panel I have the following code under a new class <?php function form($instance) { $instance = ...
3
votes
1answer
246 views

Calling static method in the Widget Class

I have a widget class Xwidget extends WP_Widget{ function cron_addB(){} } I want to run a cron job that calls that function from outside the class function xxx_cron_activation() { ; if ( ...
3
votes
2answers
911 views

File included into functions.php via require_once() won't echo?

I'm trying to load a file via require_once() to handle some enhanced functionality in my theme. I could place all the code directly inside functions.php, but I'm trying to isolate this code into its ...
3
votes
1answer
3k views

Embed iframe or html page into dashboard widget

I was wondering if it would be possible to embed an html page or add an iframe into a dashboard widget. I have a multi author blog and i want to make my admin section a simple as possible for some of ...
3
votes
1answer
947 views

Get the sidebar ID in which the current widget was dropped

How can I find out in which sidebar was a widget dropped? From inside that widget. More precisely from the form() function. Can I automatically remove the widget if it's not added in the appropriate ...
3
votes
2answers
141 views

Has anyone been able to get the aweber plugin to work

Aweber has a new api https://labs.aweber.com/ and based on that they have written a plugin: http://wordpress.org/extend/plugins/aweber-web-form-widget/ for WordPress that adds a widget. In my testing ...
3
votes
1answer
4k views

Create a Widget Area in the Navigation Bar for the Genesis Theme Framework?

(Moderator's note: The original title was "How can I create a widget area in the navigation bar (Genesis specific)?"( I'm trying to create a widget area in my navigation bar. I'm attempting to adapt ...
3
votes
2answers
531 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
189 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
283 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
1answer
70 views

Ask user permission when activating a plugin

Is there a specific Wordpress API way to ask the user's permission for something when activating a plugin? Due to the Wordpress plugin directory policy I have to ask the users consent for the ...
3
votes
2answers
583 views

Full width layout for custom post type pages

I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars: //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( ...
3
votes
2answers
924 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
6answers
6k 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
372 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
2answers
4k 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
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
815 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
3answers
2k views

Shortcode from a widget is wrapped in unwanted <p> element

I'm using Black Studio TinyMCE Widget as a rich text editor widget. In a sidebar I inserted the TinyMCE widget with a [testimonial] shortcode and some content after it. For example: [testimonial] ...
2
votes
3answers
208 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
898 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
761 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
1answer
2k 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
377 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
340 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
3answers
2k 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
1k 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
2answers
2k 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
162 views

How could a Widget behave differently depending on sidebar

if sitting on sidebar-1, I need my widget to behave differently than if it were on sidebar-2. How can i detect the sidebar it is sitting on from within the widget() function? The widget contains a ...
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
1k 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
374 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
3answers
822 views

Using $wpdb object in a widget

I'm trying to make a very simple widget that access tables contained within the same database instance as my Wordpress database, but are not wordpress tables. I'm using the wpdb class according to the ...
2
votes
1answer
363 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
60 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
2answers
4k 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
465 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
86 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
301 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
570 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
3answers
433 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? ...