/** * Get the column headers for a screen * * @since unknown * * @param string|object $screen The screen you want the headers for * @return array Containing the headers in the format id => UI String */ function get_column_headers($screen) { global $_wp_column_headers; if (!isset($_wp_column_headers)) { $_wp_column_headers = array(); } if (is_string($screen)) { $screen = convert_to_screen($screen); } // Store in static to avoid running filters on each call if (isset($_wp_column_headers[$screen->id])) { return $_wp_column_headers[$screen->id]; } switch ($screen->base) { case 'edit': $_wp_column_headers[$screen->id] = wp_manage_posts_columns($screen); break; case 'edit-comments': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'author' => __('Author'), 'comment' => _x('Comment', 'column name'), 'response' => __('In Response To')); break; case 'link-manager': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'name' => __('Name'), 'url' => __('URL'), 'categories' => __('Categories'), 'rel' => __('Relationship'), 'visible' => __('Visible'), 'rating' => __('Rating')); break; case 'upload': $_wp_column_headers[$screen->id] = wp_manage_media_columns(); break; case 'categories': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'posts' => __('Posts')); break; case 'edit-link-categories': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'links' => __('Links')); break; case 'edit-tags': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'posts' => __('Posts')); break; case 'users': $_wp_column_headers[$screen->id] = array('cb' => '<input type="checkbox" />', 'username' => __('Username'), 'name' => __('Name'), 'email' => __('E-mail'), 'role' => __('Role'), 'posts' => __('Posts')); break; default: $_wp_column_headers[$screen->id] = array(); } $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]); return $_wp_column_headers[$screen->id]; }
/** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page * @return unknown */ function get_column_headers($page) { global $_wp_column_headers; if ( !isset($_wp_column_headers) ) $_wp_column_headers = array(); // Store in static to avoid running filters on each call if ( isset($_wp_column_headers[$page]) ) return $_wp_column_headers[$page]; switch ($page) { case 'edit': $_wp_column_headers[$page] = wp_manage_posts_columns(); break; case 'edit-pages': $_wp_column_headers[$page] = wp_manage_pages_columns(); break; case 'edit-comments': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'author' => __('Author'), 'comment' => _c('Comment|noun'), //'date' => __('Submitted'), 'response' => __('In Response To') ); break; case 'link-manager': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'name' => __('Name'), 'url' => __('URL'), 'categories' => __('Categories'), 'rel' => __('rel'), 'visible' => __('Visible') ); break; case 'upload': $_wp_column_headers[$page] = wp_manage_media_columns(); break; case 'categories': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'posts' => __('Posts') ); break; case 'edit-link-categories': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'links' => __('Links') ); break; case 'edit-tags': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'name' => __('Name'), 'slug' => __('Slug'), 'posts' => __('Posts') ); break; case 'users': $_wp_column_headers[$page] = array( 'cb' => '<input type="checkbox" />', 'username' => __('Username'), 'name' => __('Name'), 'email' => __('E-mail'), 'role' => __('Role'), 'posts' => __('Posts') ); break; default : $_wp_column_headers[$page] = array(); } $_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]); return $_wp_column_headers[$page]; }
<?php if ( ! defined('ABSPATH') ) die(); ?> <table class="widefat"> <thead> <tr> <?php $posts_columns = wp_manage_media_columns(); ?> <?php foreach($posts_columns as $post_column_key => $column_display_name) { if ( 'cb' === $post_column_key ) $class = ' class="check-column"'; elseif ( 'comments' === $post_column_key ) $class = ' class="num"'; else $class = ''; ?> <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th> <?php } ?> </tr> </thead> <tbody id="the-list" class="list:post"> <?php if ( have_posts() ) { $bgcolor = ''; add_filter('the_title','wp_specialchars'); while (have_posts()) : the_post(); $class = 'alternate' == $class ? '' : 'alternate'; global $current_user; $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); ?> <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">