I've got a single page where I wish to create a pagination for any certain custom publish type known as 'article' and I am also utilizing a $_GET param known as 'week'.

Essentially after i visit http://www.mydomain.com/single-page/?week=7 I wish to begin to see the pagination of my posts from 'article' publish type with taxonomy known as week comparable to 7.

All it's fine, but paginate_links function does not act the way i want. For instance the two pagination link has this url http://www.mydomain.com/single-page/?week=7/page/2. But this url does not work, it gives an 404 Error.

But this url http://www.mydomain.com/single-page/page/2/?week=7 it's working. What exactly may be the solution?

  1. It is possible to method to tell Wordpress to make use of www.mydomain.com/single-page/page/2/?week=7 after i visit www.mydomain.com/single-page/?week=7/page/2 ?

  2. Have you got good quality tutorial for custom posts type pagination?

This is actually the code I am using to paginate:

//The paginate function

    function paginate_articles_week()
    {
        global $wp_query, $wp_rewrite;
        $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
        $pagination = array(
            'base' => @add_query_arg('page'),
            'format' => '?page=%#%',
            'total' => $wp_query->max_num_pages,
            'current' => $current,
            'show_all' => true,
            'type' => 'list',
            'prev_text' => '«',
            'next_text' => '»',
        );
        if ($wp_rewrite->using_permalinks())
            $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
        if (!empty($wp_query) && $pagination['total'] != 1) {
            $pagination['add_args'] = array('s' => get_query_var('s'));
            echo "<div class='paginate'><strong>Pagini:</strong>" . paginate_links($pagination) . "</div>";
        }
    }

//The page template

global $post;

$week = $_GET['week'];
$slug = 'week-' . $week . '-month-2';

$paged = 1;
$postsPerPage = 1;

if (get_query_var('paged')) { $paged = get_query_var('paged'); }
if (get_query_var('page'))  { $paged = get_query_var('page');  }

$args = array(
    'post_type'=> 'article',
    'paged'    => $paged,
    'posts_per_page' => $postsPerPage,
    'timeline'       => $slug
);


query_posts($args);
{the loop}

paginate_articles_week();

Thanks ahead of time for that solutions :)