Hi there,
i use the Page Builder and its one of the best wp-plugins i found in the last months. I wrote three custom widgets for the builder and they work fine, but one of the widget is visible twice in the “Add New Widget” Overlay and i just don’t know why. As seen here: http://de.tinypic.com/r/14vpdnd/8
And its irrelevant which Widget i choose, they work. However the difference Widget description shows that the left Widget in the Image uses the description defined in my function “add_mptmp_singleitem_widget” which will be triggered on the hook “siteorigin_panels_widgets”
Implementation:
function add_mptmp_singleitem_widget($widgets) {
$widgets['mptm-singleitem-widget'] = array(
'class' => 'Mptm_Singleitem_Widget',
'title' => '(MPTM) Single Item',
'description' => 'Zeigt einen Beitrag oder eine Mediadatei an'
);
return $widgets;
}
// add widget to page builder
add_filter('siteorigin_panels_widgets', 'add_mptmp_singleitem_widget');
And the right Widget uses the description used in the construct function of the Widget class, which will be triggered on registration of the widget.
class Mptm_Singleitem_Widget extends WP_Widget {
/**
* Class constructer. Constructs Widget with help
* of parent WP_Widget Class
*/
function __construct() {
parent::__construct(
'mptm_singleitem_widget', // Base ID
__( '(MPTM) Single item', 'mptm' ), // Name
array( 'description' => __( 'Zeigt einen ausgewählten Artikel an', 'mptm' ) ) // Args
);
}
}
// register widget function
function register_mptmp_singleitem_widget() {
register_widget( 'Mptm_Singleitem_Widget' );
}
// register widget on widget init
add_action( 'widgets_init', 'register_mptmp_singleitem_widget' );
sorry for my english, i’m no native speaker.