Last active
January 1, 2016 10:49
-
-
Save GaryJones/8133765 to your computer and use it in GitHub Desktop.
Usage examples for Gamajo_Dashboard_Glancer
This file contains hidden or 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 | |
// Require the new class (change to your correct path) | |
if ( ! class_exists( 'Gamajo_Dashboard_Glancer' ) ) { | |
require plugin_dir_path( 'includes/class-gamajo-dashboard-glancer.php' ); | |
} | |
// Hook into the widget (or any hook before it!) to register your items. | |
add_action( 'dashboard_glance_items', 'prefix_add_dashboard_counts' ); | |
function prefix_add_dashboard_counts() { | |
$glancer = new Gamajo_Dashboard_Glancer; | |
$glancer->add( 'my_cpt' ); // show only published "my-cpt" entries | |
} |
This file contains hidden or 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 | |
// Require the new class (change to your correct path) | |
if ( ! class_exists( 'Gamajo_Dashboard_Glancer' ) ) { | |
require plugin_dir_path( 'includes/class-gamajo-dashboard-glancer.php' ); | |
require plugin_dir_path( 'includes/class-gamajo-dashboard-rightnow.php' ); | |
} | |
// WP 3.8 and later | |
add_action( 'dashboard_glance_items', 'prefix_add_dashboard_counts' ); | |
function prefix_add_dashboard_counts() { | |
$post_types = array( 'mp_ingredient', 'mp_recipe', 'mp_mealplan' ); | |
$statuses = array( 'publish', 'draft' ); | |
$glancer = new Gamajo_Dashboard_Glancer; | |
$glancer->add( $post_types, $statuses ); | |
} | |
// WP 3.7 and earlier | |
add_action( 'right_now_content_table_end', 'prefix_add_dashboard_counts_old' ); | |
function prefix_add_dashboard_counts_old() { | |
$post_types = array( 'mp_ingredient', 'mp_recipe', 'mp_mealplan' ); | |
$statuses = array( 'publish', 'draft' ); | |
$glancer = new Gamajo_Dashboard_RightNow; | |
$glancer->add( $post_types, $statuses ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment