WordPress custom post type pagination

I have come to this problem many times before and this is the only solution, I have come across to fix my little problem.

  1. I start by creating a post type using Custom post type UI plugin.
  2. Then create a page on my theme folder: archive-{post-type}.php (archive-movie.php)
  3. I then paste the following on your page

 

//archive-movies.php
$post_type_link = (get_post_type_archive_link(get_post_type()));
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$args = array(
	'post_type'   => 'work',
	'post_status' => 'publish',
	'posts_per_page' => 2,
	'orderby'     =>  'meta_value',
	'order' 		  =>  'ASC',
	'paged' 		  => $paged,
	'caller_get_posts'=> 1,
);
$wp_query = new WP_Query($args);

//start loop
if ($wp_query->have_posts()): while ($wp_query->have_posts()) : $wp_query->the_post();
   //code goes here//

endwhile;  endif;
//end loop

echo ( paginate_links($args = array(
	'base'         => $post_type_link.'%_%',
	'format'       => 'page/%#%/',
	'total'        => $wp_query->max_num_pages,
	'current'      => $paged,
	'show_all'     => False,
	'end_size'     => 1,
	'mid_size'     => 2,
	'prev_next'    => false,
	'prev_text'    => false,
	'next_text'    => false,
	'type'         => 'plain',
	'add_args'     => False,
	'add_fragment' => '' 
)));

 

 

You may need to set the “Archive to true” on your “custom post type UI” plugin when you create the post type from there and refresh your permalink page by going to Settings->permalinks click save.

You may need the following plugin[s], for it to work properly:

http://wordpress.org/extend/plugins/custom-post-type-ui/

If you need any help with this, leave a comment I will try and help when I can.