Skip to content

Instantly share code, notes, and snippets.

@mavieth
Created December 30, 2015 00:17
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 mavieth/ed4e0b6700d91de24c72 to your computer and use it in GitHub Desktop.
Save mavieth/ed4e0b6700d91de24c72 to your computer and use it in GitHub Desktop.
<?php
// Misc Functions
// Function that outputs the contents of the dashboard widget
function dash_widget( $post, $callback_args ) {
$posts_array = get_posts(
array(
'post_type' => 'post',
'orderby' => 'post_date',
'posts_per_page' => -1
)
);
foreach ($posts_array as $post) {
$id = $post->ID;
$title = $post->post_title;
$meta = get_post_meta($id);
$custom = $meta['custom_meta'][0];
echo "<pre>";
print_r($posts_array);
echo "</pre>";
}
}
// Function used in the action hook
function add_dashboard_widget_action() {
wp_add_dashboard_widget('dashboard_widget', 'Example Dashboard Widget', 'dash_widget');
}
// Register the new dashboard widget with the 'wp_dashboard_setup' action
add_action('wp_dashboard_setup', 'add_dashboard_widget_action' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment