Guest User

Untitled

a guest
Feb 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. public function flat_generate_view() {
  2. // echo "Suck.";
  3. $query = new WP_Query(array(
  4. 'post_type' => 'sf_project',
  5. 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash')
  6. )
  7. );
  8. $post_type = 'sf_project';
  9. $post_new_file = "post-new.php?post_type=$post_type";
  10. ?>
  11. <a href="<?php echo admin_url( $post_new_file ) ; ?> " class="page-title-action"> Add </a>
  12. <!-- <a href="<?php // echo get_site_url(); ?>/wp-admin/post-new.php?post_type=sf_project" class="page-title-action">Add</a> -->
  13. <?php
  14. // var_dump($query->posts);
  15. if($query->posts):?>
  16. <table>
  17. <?php
  18. foreach($query->posts as $key=>$post):?>
  19. <tr>
  20. <td><?php echo $post->post_title; if($post->post_status == 'trash') echo "(trashed)"; ?></td>
  21. <td><a href="<?php the_permalink($post->ID); ?>">View</a></td>
  22. <td><a href="<?php echo admin_url('post.php?post=' . $post->ID . '&action=edit'); ?>">Edit</a></td>
  23. <td>
  24. <?php if($post->post_status == 'trash'): ?>
  25. <?php
  26. // $_wpnonce = wp_create_nonce( 'untrash-post_' . $post_id );
  27. // $url = admin_url( 'post.php?post=' . $post_id . '&action=untrash&_wpnonce=' . $_wpnonce );
  28. // return $url;
  29. ?>
  30. <a href="<?php echo wp_nonce_url(admin_url('post.php?post=' . $post->ID . '&action=untrash'), 'untrash-post_' . $post->ID); ?>">Untrash</a>
  31. <a href="<?php echo get_delete_post_link($post->ID, '', true); ?>">Delete</a>
  32. <?php else: ?>
  33. <a href="<?php echo get_delete_post_link($post->ID, '', false); ?>">Trash</a>
  34. <?php endif; ?>
  35. </td>
  36. </tr>
  37. <?php
  38. endforeach;
  39. ?>
  40.  
  41. </table>
  42. <?php
  43. endif;
  44. }
Add Comment
Please, Sign In to add comment