Articles of widgets

Including Custom Post Type posts in a page template contextually (or should I widget?)

Please see the attached mockup… Each element in the sidebar (e.g., Communications) will probably have to be a Page. I’m aiming for maximum flexibility. I am using Epik (a Genesis child theme). I am trying to avoid having the people who will be creating the content for this site needing to know HTML/CSS so I […]

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(){ register_widget(‘postType_widget’); } class postType_widget extends WP_Widget { function postType_widget() { $widget_ops = array( ‘classname’ => ‘postType_widget’, ‘description’ => __(‘Display Posts by Post Type’) ); $control_ops = array( ‘width’ => 300, ‘height’ => 350, […]

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 sidebar plugins out there. Unfortunately, I haven’t found one which cover all my wishes. So I’d like to code this […]

the_widget() and widget's ID

Let’s assume I have a widget that displays only its name: <p> <?php echo $args[‘widget_id’] ?> </p> So when I drag & drop my widget to any sidebar it shows: <p> myWidget-number </p> The problem is I want to call this widget with a shortcode: (…) ob_start(); the_widget(MyWidget); return ob_get_clean(); } add_shortcode(‘myWidget_short’, ‘myWidget_shortcode’); And when […]

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

Widgets with groups / sub widgets? Widget in a widget?

I tried to find anything about adding a widget within a widget area. That widget should be a widget group / sub widget area. I’ve found a plugin that does this: What I really want is to dynamically create something like this without the help from plugins: Any bright ideas?

Using tabs in admin widgets

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 selection between page loads (nice!). Been trying to add tabs to an admin widget to reduce the form footprint when […]

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 using widgets (I create the spaces needed for the widget and they drag and drop the menus into that […]

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 functionality there will be differing widget-level variables that I will need to individually pass from PHP to JavaScript to take action on […]

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: So my question is how do I add the CPTs to a custom dashboard widget? Any […]