Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <header class="entry-header">
- <h1 class="entry-title"><?php the_title(); ?></h1>
- </header>
- <!-- The Loop -->
- <?php
- while ( have_posts() ) : the_post();
- the_content();
- endwhile; // end of the loop.
- ?>
- <?php
- //Retrieves the current logged in user information
- $current_user = wp_get_current_user();
- if ( !($current_user instanceof WP_User) )
- return;
- ?>
- <?php
- $args = array( 'post_type' => 'deviation',
- 'posts_per_page' => '-1', // All in one page
- 'author' => $current_user->ID,
- 'order' => 'DESC', // Start with first date of month
- 'orderby' => 'meta_value', // Sorting by date of month
- 'meta_key' => 'dev_date', // Which field to check - The date field
- 'post_status' => 'all',
- );
- $query = new WP_Query( $args );
- if( $query->have_posts() ) { ?>
- <table id="allDeviations">
- <thead>
- <tr>
- <th>Anledning</th>
- <th>Datum</th>
- <th>Status</th>
- <th>Åtgärd</th>
- </tr>
- </thead>
- <tbody><?php
- while ($query->have_posts()) : $query->the_post(); ?>
- <tr>
- <td><?php
- $mykey_values = get_post_custom_values('dev_reason');
- foreach ( $mykey_values as $key => $value ) {
- echo "$value";
- } ?>
- </td>
- <td><?php
- $mykey_values = get_post_custom_values('dev_date');
- foreach ( $mykey_values as $key => $value ) {
- echo "$value";
- } ?>
- </td>
- <td>
- <?php echo $post->post_status; ?>
- </td>
- <td><?php
- if ( (wpuf_get_option( 'enable_post_edit', 'wpuf_dashboard' ) == 'yes') && (wpuf_get_option('enable_post_del', 'wpuf_dashboard', 'yes') == 'yes') && ( ($post->post_status != 'publish') )) {
- $del_url = add_query_arg( array('action' => 'del', 'pid' => $post->ID) );
- $edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_general' );
- $edit_url = add_query_arg( array('pid' => $post->ID), get_permalink( $edit_page ) );
- ?>
- <a href="<?php echo wp_nonce_url( $del_url, 'wpuf_del' ) ?>" onclick="return confirm('Are you sure to delete?');"><span style="color: red;"><?php _e( 'Delete', 'wpuf' ); ?></span></a>
- <a href="<?php echo wp_nonce_url( $edit_url, 'wpuf_edit' ); ?>"><?php _e( 'Edit', 'wpuf' ); ?></a>
- <?php
- } ?>
- </td>
- </tr><?php
- endwhile;
- echo '</tbody>';
- echo '</table>';
- } else {
- echo '<p>Inga avvikelser är registrerade.</p>';
- }
- wp_reset_query(); // Restore global post data stomped by the_post().
- ?>
- </article>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement