Skip to content

Instantly share code, notes, and snippets.

@zverush
Created November 21, 2015 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zverush/2b7da8321bd891a758b1 to your computer and use it in GitHub Desktop.
Save zverush/2b7da8321bd891a758b1 to your computer and use it in GitHub Desktop.
WP Dashboard Widget
<?php
// https://generatewp.com/introducing-dashboard-widgets-generator/
class Hello_World_Dashboard_Widget {
public function __construct() {
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
}
public function add_dashboard_widget() {
wp_add_dashboard_widget(
'hello_world_widget',
__( 'Hello World', 'text_domain' ),
array( $this, 'render_dashboard_widget' )
);
}
public function render_dashboard_widget() {
echo "Hello World...";
}
}
new Hello_World_Dashboard_Widget;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment