So I'm currently working on a custom plugin that is relying on custom post types. I am then displaying these custom post types in an admin page but can't seem to get the pagination to display! I have no idea what I'm doing wrong.
This is the loop I am running:
<?php
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) {$paged = get_query_var('page'); } else {$paged = 1; }
$mypost = array( 'posts_per_page' =>'1','paged'=>$paged,'post_type' => 'usernotes', 'meta_query' => array(
array(
'key' => 'userNotesID',
'value' => get_current_user_id( )
)
));
$loop = new WP_Query( $mypost );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post();?>
<section class="innerWrapper">
<article id="<?php the_ID(); ?>" class="note" <?php post_class(); ?>>
<header class="entry-header">
<!-- Display Title and Author Name -->
<span class="title"><?php the_title(); ?></span>
<span class="date"><?php the_time(get_option('date_format')); ?></span>
</header>
<div class="noteInner">
<?php the_content(); ?>
</div>
<footer>
<a href="'#" class="delete button-red" id="<?php the_ID(); ?>">Hide Note</a>
<div class="clear"></div>
</footer>
</article>
</section>
<?php endwhile; ?>
It displays 1 post as it should and if I increase the posts_per_page to 2 then it as it should shows 2 posts. The problem is I can't get any pagination links to work. If I have it set to 1 and then navigation to ?paged=2, nothing changes, it just shows the first post only! Any idea why or what I can try?
EDIT:
Should probably add this is on an admin page, displaying custom post types.