Created
December 30, 2015 00:17
-
-
Save mavieth/ed4e0b6700d91de24c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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