I created this widget using a simple example on WordPress Codex:
<?php
function widget_container_latest_posts() {
global $wpdb;
global $post;
get_template_part( '/includes/containers/container-latest-posts' );
}
wp_register_sidebar_widget(
'widget_container_latest_posts_1',
'Container Latest Posts',
'widget_container_latest_posts',
array(
'description' => 'Container Latest Posts - Adds recent posts.'
)
);
?>
It works fine, but I want this widget to be used multiple times not only one time after I drag it on a sidebar widgets place, and so I can add it on all the other sidebars for example.
Thank
You need to implement your Widget using the Widgets API, so that WordPress knows how to make multiple instances of the Widget.
Your Widget declaration should take the following format: