Thêm dashboard widgets

Cập nhật lần cuối 16/03/2017 by trong WordPress vào 13/10/2013 có 907 Views
Thêm dashboard widgets

Thêm dashboard widgets


Khi đã remove dashboard widgets rồi thì các bạn có thể thêm vào các dashboard widgets khác…

Code ngắn gọn như sau.

// Function that outputs the contents of the dashboard widget
function dashboard_widget_function() {
echo "Hello World, this id my first Dashboard Widget!";
}
// Function used in the action hook
function add_dashboard_widgets() {
wp_add_dashboard_widget('dashboard_widget', 'Example Dashboard Widget', 'dashboard_widget_function');
}
// Register the new dashboard widget with the 'wp_dashboard_setup' action
add_action('wp_dashboard_setup', 'add_dashboard_widgets' );

Các bạn có thể xem chi tiết tại đây.

Chúc các bạn thành công!

5/5 - (1 vote)
  • Bình luận
Sản phẩm nổi bật của Toản
x