Last active
August 29, 2015 14:09
-
-
Save jakewhiteley/ed201aa6f2f98e19f583 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 | |
/** | |
* For each page each, loop through registered columns, and output value | |
* @param String - current column name | |
* @param Int - current page ID | |
*/ | |
function populate_column ( $column, $page_id ) | |
{ | |
switch ( $column ) { | |
// if the current column name is template | |
case 'template' : | |
$p = get_page_template_slug( $page_id ); // get current page template | |
echo ($p == '' ? 'Default Template' : $p); // write 'Default Template' if no custom template detected | |
break; | |
} | |
} | |
// hook our function nito Wordpress | |
add_action('manage_pages_custom_column', 'populate_column', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment