Last active
August 29, 2015 14:05
-
-
Save hellofromtonya/41a1aef689dc9d0c5fc7 to your computer and use it in GitHub Desktop.
Adds Stats to the New Column within WordPress' Posts & Pages Listings
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
add_action('manage_page_posts_custom_column', 'lunarwp_core\add_stats_column_render', 10, 2); | |
add_action('manage_post_posts_custom_column', 'lunarwp_core\add_stats_column_render', 10, 2); | |
/** | |
* Add Stats to to the Posts & Pages Listings (in Admin area) | |
* | |
* @since 1.0.0 | |
* | |
* @param array $column Post Listing Columns | |
* @param integer $post_id Post ID | |
* @return array Returns the amended columns array | |
*/ | |
function add_stats_column_render($column, $post_id) | |
{ | |
switch($column) | |
{ | |
case 'lunarwp_stats': | |
esc_html_e(genesis_get_custom_field('_lunarwp_stats_views')); | |
//* If you are not using the Genesis framework, use this line instead | |
// esc_html_e(get_post_meta($post_id, '_lunarwp_stats_views', true); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment