Articles of widgets

How to create a widget that has a submit form in the front end

How to create a widget that has a submit form in the front end? The reason for this is I’m teaching myself plugin development and I’m struggling on how to display a form on the front end after adding the widget to the sidebar. my code thus far function widget ($args,$instance) { extract( $args ); […]

Class 'WP_Widget' not found

I am learning WordPress development with a tutorial where we learn to create a widget, it is asked to create a file named newsletterwidget.php with the following code, but it does not say in which folder to put it: class Zero_Newsletter_Widget extends WP_Widget { public function __construct() { parent::__construct(‘zero_newsletter’, ‘Newsletter’, array(‘description’ => ‘Un formulaire d\’inscription […]

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 create a widget that shows a 3×3 set of the most recent images used in posts. Any thoughts on […]

Is it a good idea to make whole theme widgetized?

I have mainly seen sites using widgets on sidebars or inside multi-column layout. However, I was wondering what if we could use widgets in every blocks like header, main content block, footer etc. Is that a good or a bad idea?

Multiple users editting widgets

I have just completed a website using WordPress as a CMS, the site has 6 people administering the content and in the couple of days before launch all 6 were updating the content. We found that if multiple people were editing/creating widgets at the same time this would save over and some of the widgets […]

How to register custom menu widget

I’m trying to register a custom menu widget programmatically with wp_register_sidebar_widget, but it doesn’t appear in wordpress. I’m using remote call of that method (xml-rpc). Referring to codex I’m passing parametres like that to that method: wp_register_sidebar_widget( ‘custom_menu_widget-1’, ‘My name’, ‘WP_Nav_Menu_Widget’, array( ‘description’ => ‘blogroll’ ) ); It should create custom menu widget named ‘My […]

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 configure the custom menu widget to do the same? I mean, for achieve <ul class=”nav nav-tabs nav-stacked”>%3$s</ul> in all custom menu widgets, by default. Thanks for help! Have […]

Add new section to “Right Now” widget

I’ve been hacking away at modifying the “Right Now” widget in the WordPress dashboard, and although there are some hooks/filters which apply to just that, they are sparsely documented or explained. Using the example given here, I’ve created a new row of information in the “Content” section of the widget… I also tried a few […]

Dynamic content in a widget

I have to make a widget from where the user will be able to add a few images and then I will show only some of them, randomly, and it will be automatically changed on page refresh. The problem is that the number of images is not known, it may be 2, it may be […]

Broken markup when using the_excerpt() in a widget?

The text returned by the_excerpt() does not respect my widget format. I couldn’t explain it better so I will just show you my code: function widget($args, $options) { extract($args); $post_type = $options[‘post_type’]; $num_of_posts = $options[‘limit’]; // Create a new instance $second_query = new WP_Query( array( ‘post_type’ => “$post_type”, ‘posts_per_page’ => “$num_of_posts”, ‘post_status’ => ‘publish’, ) […]