I recently created a widget in my functions.php with following code :
register_sidebar(
array(
'name' => __( 'Informations importantes', 'twentynineteen' ),
'id' => 'informations-widget',
'description' => __( 'Ajouter ici le slider vous permettant de mettre en avant des informations complémentaires.', 'twentynineteen' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
No problem at this point, it appears normally on the Appearance -> Widgets section
Well now, i have an issue when i try to make it appear on my dashboard i can add a custom widget without any problem, but make an existing appear on dashboard it is a little more difficult. I tried with this code ( with 'informations widget' as the idea of the original widget :
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
function my_custom_dashboard_widgets() {
add_meta_box('informations-widget', 'Dashboard Widget Title',
'custom_dashboard_infos', 'dashboard', 'side', 'high');
}
function custom_dashboard_infos() {
echo '<p>Une infos importantes';
}
Thanks in advance for the help !