Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #453


    first of all: great work with cleancut.

    I would like to have pagination (page 1, 2, 3, 4) for the portfolio pages as with many portfolio items its gets really slow.

    You got a fast fix for that?




    The number of posts was originally set to 9999 so that everything would load on one page. You can add pagination and reduce the number of entires you want to show.

    Open up template_portfolio.php and change this code:

    $posts_per_page = 9999;

    $query_string = "posts_per_page=".$posts_per_page;
    $query_string .= "&post_type=portfolio";

    to this:

    $posts_per_page = 9999;

    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;

    $query_string = "posts_per_page=".$posts_per_page;
    $query_string .= "&post_type=portfolio";
    $query_string .= "paged=".$paged;

    Change 9999 to the number of posts you want to display per page, make it divisible by the number of columns you have chosen so it “fits” the page.



    this code makes all my entries disappear.

    Set $posts_per_page = 16; btw.

    I changed it back to the old code otherwise all my entries would be offline.



    Sorry, quick typing and I missed a character. This:

    $query_string .= "paged=".$paged;

    should be this:

    $query_string .= "&paged=".$paged;

    Let me know how you get on.

    Best regards,



    Thanks but still not working as:

    • $post_per_page set to 12 but not links to next pages are displayed
    • First page of all portfolio entries (ie all portfolio types should be visible) shows only the first type of portfolio. The second and following types of portfolios disappear. Also when I click on the page with the second type of portfolio it is empty – everything gets paginated away it seems.

    If I change it back to original code I can see all the portfolio entries again.


    For the pagination page links (page 2 / 3 etc) add this code just before <!–end main–>:

    <?php kriesi_pagination(); ?>

    All Portfolio entries should show up as they are all under the Portfolio post type and this is part of the query_string:

    $query_string .= "&post_type=portfolio";

    I’ll have a play around with this and get back to you.


    Thanks, I will wait for the results – I know the entries should show up but you will see that if you have 2 pages with different types of portfolios, only the first one is complete, the second one gets filtered away (due to the pagination).



    Unfortunatley it is not possible in cleancut to add a pagination. The general problem is that wordpress 3 custom post types (other than basic posts or pages) only allow certain queries to work. For example it is not possible with basic methods to get portfolio entries from only 2 different categories.

    To add this feature I needed to query all portfolio entries and then sort them with a php function. That leads to the fact that the pagination doesn’t work any longer, therefore it was disabled as a whole in cleancut.

    I added it later in avisio but only with a 200 line codefix that is not really applicable to the cleancut theme. Sorry for that.


    Thanks for the info.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Pagination for portfolio’ is closed to new replies.