SHOW:
|
|
- or go back to the newest paste.
1 | Welcome to you dashboard <?php global $current_user; get_currentuserinfo(); echo ($current_user->user_login); ?>. | |
2 | ||
3 | ||
4 | ||
5 | <?php | |
6 | global $current_user; | |
7 | get_currentuserinfo(); | |
8 | $user = $current_user->ID; | |
9 | ||
10 | $query = new WP_Query( array( | |
11 | 'author' => $user, // Show Posts made only by the current user. | |
12 | 'post_type' => 'tutorial', | |
13 | 'posts_per_page' => '5', | |
14 | 'post_status' => array( | |
15 | 'publish', | |
16 | 'pending', | |
17 | 'draft', | |
18 | 'private', | |
19 | 'trash' | |
20 | ) | |
21 | ) ); | |
22 | ?> | |
23 | ||
24 | <table> | |
25 | ||
26 | <tr> | |
27 | <th>Post Title</th> | |
28 | <th>Post Status</th> | |
29 | <th>Actions</th> | |
30 | </tr> | |
31 | ||
32 | <?php | |
33 | - | if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> |
33 | + | if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); |
34 | ||
35 | $post_status = get_post_status( get_the_ID() ); | |
36 | if ( $post_status == 'publish' ) $post_status = 'Approved'; | |
37 | - | <td><?php echo get_post_status( get_the_ID() ) ?></td> |
37 | + | |
38 | ?> | |
39 | ||
40 | <tr> | |
41 | <td><?php echo get_the_title(); ?></td> | |
42 | <td><?php echo $post_status; ?></td> | |
43 | <td> | |
44 | <?php the_post_thumbnail(thumbnail); ?> | |
45 | </a> | |
46 | </td> | |
47 | </tr> | |
48 | ||
49 | <?php endwhile; endif; ?> | |
50 | ||
51 | </table> |