introducing dashboard-widget

This commit is contained in:
Antoine M 2025-02-18 11:22:32 +01:00
parent c6ea399704
commit 30d9074f14

View File

@ -0,0 +1,26 @@
<?php
function custom_dashboard_widget()
{
// get user name
$current_user = wp_get_current_user();
$user_name = $current_user->user_login;
wp_add_dashboard_widget(
'advisor-dashboard-widget', // ID du widget
'Dashboard Personnel ', // Titre
'custom_dashboard_widget_display' // Fonction d'affichage
);
}
function custom_dashboard_widget_display()
{
$current_user = wp_get_current_user();
$user_name = $current_user->user_login;
?>
<h3>Bonjour <?php echo $user_name ?> !</h3>
<p>Ceci est un widget personnalisé. Vous pouvez afficher ici des infos utiles, des liens ou tout autre contenu.</p>
<?php
}
// Ajouter le widget au tableau de bord
add_action('wp_dashboard_setup', 'custom_dashboard_widget');