WordPress.org

Ready to get started?Download WordPress

Forums

Pagination for Custom post type (8 posts)

  1. Rakesh Raja
    Member
    Posted 2 years ago #

    I have quite complex loop..

    I am using custom post type with custom loop and taxnomies..

    I am displaying posts of custom post type.. listing by main taxonomy and sub taxonomy.

    Following is code
    http://pastebin.com/gpbW1dVS

    I have checked several posts here for the solution but none worked.. Please help.

    Regards

  2. David Gard
    Member
    Posted 2 years ago #

    You need to add posts_per_page and paged to your query

    $wpq = array (
        'posts_per_page' => get_option('posts_per_page'),
        'paged' => $paged,
        'taxonomy' => $taxonomy,
        'term' => $termsub->slug
    );
  3. Rakesh Raja
    Member
    Posted 2 years ago #

    I did that too but still not worked but let me try again

  4. Rakesh Raja
    Member
    Posted 2 years ago #

    It will be great if you can paste it in my code and show me .. so no mess up

  5. Rakesh Raja
    Member
    Posted 2 years ago #

    I tried it did nothing...

    Please check my dev. site..

    I want to make pagination for this page.. top bigger font is main taxonomy, and each box is sub taxnomy.. and data in tables are posts.

    I did the changed in my code and here it is .. check and let me know whats wrong.

    http://pastebin.com/xq5dNL9k

  6. Rakesh Raja
    Member
    Posted 2 years ago #

    Please please somebudy reply

  7. David Gard
    Member
    Posted 2 years ago #

    Can't be 100% as not sure exactly what you want to achieve, but this should hopefully point you in the right direction.

    $tax_query = array(
    	array(
    		'taxonomy' => 'your-taxonomy'
    		'field' => 'id' // Can also use 'slug'
    		'terms' => array(
    			20, 30, 40
    		)
    	)
    	array(
    		'taxonomy' => 'another-taxonomy'
    		'field' => 'slug' // Can also use 'slug'
    		'terms' => array(
    			term-1,
    			term-2,
    			term-3
    		)
    	)
    )
    $wpq = array (
            'paged' => $paged,
            'posts_per_page' => get_option('posts_per_page'),
            'post_type' = array('your-post-type'),
            'tax_query' => $tax_query
    );
  8. Rakesh Raja
    Member
    Posted 2 years ago #

    Anyways I have done most of the things but still one problem mate

    Check the current code

    http://pastebin.com/7NKbYEGU

    Check the current page with problem

    Demo site

    regards

Topic Closed

This topic has been closed to new replies.

About this Topic