|
1 | | -<table class="widefat"> |
2 | | - <thead> |
3 | | - <tr> |
4 | | - |
5 | | -<?php foreach($posts_columns as $column_display_name) { ?> |
6 | | - <th scope="col"><?php echo $column_display_name; ?></th> |
7 | | -<?php } ?> |
8 | | - |
9 | | - </tr> |
10 | | - </thead> |
11 | | - <tbody id="the-list"> |
12 | | -<?php |
13 | | -if ( have_posts() ) { |
14 | | -$bgcolor = ''; |
15 | | -add_filter('the_title','wp_specialchars'); |
16 | | -while (have_posts()) : the_post(); |
17 | | -$class = ('alternate' == $class) ? '' : 'alternate'; |
18 | | -global $current_user; |
19 | | -$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); |
20 | | -?> |
21 | | - <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'> |
22 | | - |
23 | | -<?php |
24 | | - |
25 | | -foreach($posts_columns as $column_name=>$column_display_name) { |
26 | | - |
27 | | - switch($column_name) { |
28 | | - |
29 | | - case 'id': |
30 | | - ?> |
31 | | - <th scope="row" style="text-align: center"><?php echo $id ?></th> |
32 | | - <?php |
33 | | - break; |
34 | | - case 'modified': |
35 | | - ?> |
36 | | - <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> |
37 | | - <?php |
38 | | - break; |
39 | | - case 'date': |
40 | | - ?> |
41 | | - <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> |
42 | | - <?php |
43 | | - break; |
44 | | - case 'title': |
45 | | - ?> |
46 | | - <td><?php the_title() ?> |
47 | | - <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td> |
48 | | - <?php |
49 | | - break; |
50 | | - |
51 | | - case 'categories': |
52 | | - ?> |
53 | | - <td><?php the_category(','); ?></td> |
54 | | - <?php |
55 | | - break; |
56 | | - |
57 | | - case 'comments': |
58 | | - ?> |
59 | | - <td style="text-align: center"> |
60 | | - <?php |
61 | | - $left = get_pending_comments_num( $post->ID ); |
62 | | - $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); |
63 | | - if ( $left ) |
64 | | - echo '<strong>'; |
65 | | - comments_number("<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('%') . '</a>'); |
66 | | - if ( $left ) |
67 | | - echo '</strong>'; |
68 | | - ?> |
69 | | - </td> |
70 | | - <?php |
71 | | - break; |
72 | | - |
73 | | - case 'author': |
74 | | - ?> |
75 | | - <td><?php the_author() ?></td> |
76 | | - <?php |
77 | | - break; |
78 | | - |
79 | | - case 'control_view': |
80 | | - ?> |
81 | | - <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> |
82 | | - <?php |
83 | | - break; |
84 | | - |
85 | | - case 'control_edit': |
86 | | - ?> |
87 | | - <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> |
88 | | - <?php |
89 | | - break; |
90 | | - |
91 | | - case 'control_delete': |
92 | | - ?> |
93 | | - <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td> |
94 | | - <?php |
95 | | - break; |
96 | | - |
97 | | - default: |
98 | | - ?> |
99 | | - <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> |
100 | | - <?php |
101 | | - break; |
102 | | - } |
103 | | -} |
104 | | -?> |
105 | | - </tr> |
106 | | -<?php |
107 | | -endwhile; |
108 | | -} else { |
109 | | -?> |
110 | | - <tr style='background-color: <?php echo $bgcolor; ?>'> |
111 | | - <td colspan="8"><?php _e('No posts found.') ?></td> |
112 | | - </tr> |
113 | | -<?php |
114 | | -} // end if ( have_posts() ) |
115 | | -?> |
116 | | - </tbody> |
117 | | -</table> |
| 1 | +<table class="widefat"> |
| 2 | + <thead> |
| 3 | + <tr> |
| 4 | + |
| 5 | +<?php foreach($posts_columns as $column_display_name) { ?> |
| 6 | + <th scope="col"><?php echo $column_display_name; ?></th> |
| 7 | +<?php } ?> |
| 8 | + |
| 9 | + </tr> |
| 10 | + </thead> |
| 11 | + <tbody id="the-list"> |
| 12 | +<?php |
| 13 | +if ( have_posts() ) { |
| 14 | +$bgcolor = ''; |
| 15 | +add_filter('the_title','wp_specialchars'); |
| 16 | +while (have_posts()) : the_post(); |
| 17 | +$class = ('alternate' == $class) ? '' : 'alternate'; |
| 18 | +global $current_user; |
| 19 | +$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); |
| 20 | +?> |
| 21 | + <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'> |
| 22 | + |
| 23 | +<?php |
| 24 | + |
| 25 | +foreach($posts_columns as $column_name=>$column_display_name) { |
| 26 | + |
| 27 | + switch($column_name) { |
| 28 | + |
| 29 | + case 'id': |
| 30 | + ?> |
| 31 | + <th scope="row" style="text-align: center"><?php echo $id ?></th> |
| 32 | + <?php |
| 33 | + break; |
| 34 | + case 'modified': |
| 35 | + ?> |
| 36 | + <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> |
| 37 | + <?php |
| 38 | + break; |
| 39 | + case 'date': |
| 40 | + ?> |
| 41 | + <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> |
| 42 | + <?php |
| 43 | + break; |
| 44 | + case 'title': |
| 45 | + ?> |
| 46 | + <td><?php the_title() ?> |
| 47 | + <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td> |
| 48 | + <?php |
| 49 | + break; |
| 50 | + |
| 51 | + case 'categories': |
| 52 | + ?> |
| 53 | + <td><?php the_category(','); ?></td> |
| 54 | + <?php |
| 55 | + break; |
| 56 | + |
| 57 | + case 'comments': |
| 58 | + ?> |
| 59 | + <td style="text-align: center"> |
| 60 | + <?php |
| 61 | + $left = get_pending_comments_num( $post->ID ); |
| 62 | + $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); |
| 63 | + if ( $left ) |
| 64 | + echo '<strong>'; |
| 65 | + comments_number("<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase'>" . __('%') . '</a>'); |
| 66 | + if ( $left ) |
| 67 | + echo '</strong>'; |
| 68 | + ?> |
| 69 | + </td> |
| 70 | + <?php |
| 71 | + break; |
| 72 | + |
| 73 | + case 'author': |
| 74 | + ?> |
| 75 | + <td><?php the_author() ?></td> |
| 76 | + <?php |
| 77 | + break; |
| 78 | + |
| 79 | + case 'control_view': |
| 80 | + ?> |
| 81 | + <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> |
| 82 | + <?php |
| 83 | + break; |
| 84 | + |
| 85 | + case 'control_edit': |
| 86 | + ?> |
| 87 | + <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> |
| 88 | + <?php |
| 89 | + break; |
| 90 | + |
| 91 | + case 'control_delete': |
| 92 | + ?> |
| 93 | + <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td> |
| 94 | + <?php |
| 95 | + break; |
| 96 | + |
| 97 | + default: |
| 98 | + ?> |
| 99 | + <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> |
| 100 | + <?php |
| 101 | + break; |
| 102 | + } |
| 103 | +} |
| 104 | +?> |
| 105 | + </tr> |
| 106 | +<?php |
| 107 | +endwhile; |
| 108 | +} else { |
| 109 | +?> |
| 110 | + <tr style='background-color: <?php echo $bgcolor; ?>'> |
| 111 | + <td colspan="8"><?php _e('No posts found.') ?></td> |
| 112 | + </tr> |
| 113 | +<?php |
| 114 | +} // end if ( have_posts() ) |
| 115 | +?> |
| 116 | + </tbody> |
| 117 | +</table> |
0 commit comments