Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function flat_generate_view() {
- // echo "Suck.";
- $query = new WP_Query(array(
- 'post_type' => 'sf_project',
- 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash')
- )
- );
- $post_type = 'sf_project';
- $post_new_file = "post-new.php?post_type=$post_type";
- ?>
- <a href="<?php echo admin_url( $post_new_file ) ; ?> " class="page-title-action"> Add </a>
- <!-- <a href="<?php // echo get_site_url(); ?>/wp-admin/post-new.php?post_type=sf_project" class="page-title-action">Add</a> -->
- <?php
- // var_dump($query->posts);
- if($query->posts):?>
- <table>
- <?php
- foreach($query->posts as $key=>$post):?>
- <tr>
- <td><?php echo $post->post_title; if($post->post_status == 'trash') echo "(trashed)"; ?></td>
- <td><a href="<?php the_permalink($post->ID); ?>">View</a></td>
- <td><a href="<?php echo admin_url('post.php?post=' . $post->ID . '&action=edit'); ?>">Edit</a></td>
- <td>
- <?php if($post->post_status == 'trash'): ?>
- <?php
- // $_wpnonce = wp_create_nonce( 'untrash-post_' . $post_id );
- // $url = admin_url( 'post.php?post=' . $post_id . '&action=untrash&_wpnonce=' . $_wpnonce );
- // return $url;
- ?>
- <a href="<?php echo wp_nonce_url(admin_url('post.php?post=' . $post->ID . '&action=untrash'), 'untrash-post_' . $post->ID); ?>">Untrash</a>
- <a href="<?php echo get_delete_post_link($post->ID, '', true); ?>">Delete</a>
- <?php else: ?>
- <a href="<?php echo get_delete_post_link($post->ID, '', false); ?>">Trash</a>
- <?php endif; ?>
- </td>
- </tr>
- <?php
- endforeach;
- ?>
- </table>
- <?php
- endif;
- }
Add Comment
Please, Sign In to add comment