WordPress.org

Ready to get started?Download WordPress

Forums

Problem with Pagination for Custom Post Types (5 posts)

  1. cirtoska
    Member
    Posted 1 year ago #

    I have seen many had problems with pagination for Custom Post Types and most of them have successfully solved their issue. I still have no luck in that.

    Here is my problem.

    I'm using Custom Post Type UI for creating Custom Post types ( for example one of the post types that I've created is articles ).
    For listing them I have created Page Template articles.php and the slug that I'm using for that page is article ( for example the page where I have created is listed here http://esotericquotes.com/article/ ).

    The first page is listing fine, but when I go to the next page it redirect to the first page and gives the permalink of the second page http://esotericquotes.com/article/page/2/

    I'm using Maxx - Responsive Creative WordPress Theme and the code for the pagination for this theme looks like this:

    /*Custom Pagination
    /*---------------------------------------------------------------------------------------------*/
    if ( ! function_exists( 'md_pagi_nav' ) ) :
    	function md_pagi_nav(array $query = array()) {
    	?>
    	<div class="m-pagination">
    			<?php
                    global $wp_query;
    
                    $big = 999999999; 
    
                    echo paginate_links( array(
                        'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                        'format' => '?paged=%#%',
                        'current' => max( 1, get_query_var('paged') ),
                        'total' => $wp_query->max_num_pages,
                        'next_text'    => __('Next &rarr;','framework'),
                        'prev_text'    => __('&larr; Prev','framework')
                    ) );
                ?>
                <span class="pagination-meta">
                    <?php
                        //display Page x of y pages
                        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                        echo 'Page ' . $paged . ' of ' . $wp_query->max_num_pages ;
    
                    ?>
                </span>
    
            </div>
    
            <?php
    	}
    endif;

    Can someone with more experience in coding help me how to solve this issue please?

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    You may have better help posting on the plugin's forum here:

    http://wordpress.org/support/plugin/custom-post-type-ui

  3. cirtoska
    Member
    Posted 1 year ago #

    Thank you for the response. I have post this issue on plugin forum but I don't think that it's their problem. I think that this has something with the pagination code that I've post before.

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    If it's a theme question, then you may want to ask the theme developers - as commercial themes aren't supported on these forums.

  5. cirtoska
    Member
    Posted 1 year ago #

    Yes I know. I wrote to the theme developer but he didn't wrote me back. That's why I'm trying to find help here.

Topic Closed

This topic has been closed to new replies.

About this Topic