WordPress.org

Ready to get started?Download WordPress

Forums

Leaf
[closed] pagination issue (14 posts)

  1. amjansen
    Member
    Posted 1 year ago #

    My front page (with the slider) works great, but I can't get it to display any other pages. Specifically, there was no pagination at the end of the first page so readers could get to older articles so I took the code from the Blog Page Template that reads <?php leaf_pagination(); ?> and put it in the code for the Home Page. Now it shows up, but no matter what number you click on it takes you back to the Home Page. Did I miss something in the code?

  2. tizz
    Member
    Posted 1 year ago #

    Same here, and it's the same for everyone, but the blog template.
    You're not wrong at all, <?php leaf_pagination(); ?> should be enough. The problem is due to the particular loop of the home page, the loop code must be fixed by his author.
    In fact, where the loop is normal, like categories archives, pagination works.
    It's the only thing I'm missing to be able to start using this theme, I can't conceive a home without pagination.
    It would be great if the author tell us what need to be fixed and how in the loop of the home page.
    I read Codex about this problem, but I haven't so many php coding skills.

  3. tizz
    Member
    Posted 1 year ago #

    Solved, I don't think if it's perfect, I'm not a coder, but at least pagination now works.
    You must add 'paged' => $paged before the loop in correspondance of 'posts_per_page' in every interested section.
    Example:
    in <?php /********* Slider Section. *********/ ?>)

    $args = ( array( 'posts_per_page' => 5, 'paged' => $paged, 'post__not_in' => get_option( 'sticky_posts' ) ) );
    } else {
    $args = ( array( 'posts_per_page' => 5, 'paged' => $paged, 'category__in' => $options['leaf_slider_cat'], 'post__not_in' => get_option( 'sticky_posts' ) ) );
    }

    Same in <?php /********* Featured Section. *********/ ?>

    <?php $loop = new WP_Query( array( 'posts_per_page' => 1, 'paged' => $paged, 'post__in' => get_option( 'sticky_posts' ),'post__not_in' => $no_duplicates, 'ignore_sticky_posts' => 1 ) ); ?>

    In this way you have different post in slider (5 last new every page) and in home page categories.
    It must be said that until a post in a certain category is not in the slider, the posts in that category will be the same on the pages where in that moment none of these posts is in the slider.
    I don't know if this solution can be improved, pls author give a sign.

    http://codex.wordpress.org/Pagination#Adding_the_.22paged.22_parameter_to_a_query

  4. emmykk
    Member
    Posted 12 months ago #

    pls show a sample website that is using it pls.and reproduce the codes that did it

  5. tizz
    Member
    Posted 11 months ago #

    The website in my name

  6. emmykk
    Member
    Posted 11 months ago #

    tizz i can see you have configure that pagination in the home page,can you please share how you did that?

  7. emmykk
    Member
    Posted 11 months ago #

    but in my case i like it to be after the more article session.and when click article should be in the blog form.not repeating the 4 category colum.

  8. tizz
    Member
    Posted 11 months ago #

    I can tell you how I've done.

    In <?php /********* Featured Section. *********/ ?>

    <?php $loop = new WP_Query( array( 'posts_per_page' => 1,'post__in' => get_option( 'sticky_posts' ),'post__not_in' => $no_duplicates, 'ignore_sticky_posts' => 1 ) ); ?>

    changed in

    <?php $loop = new WP_Query( array( 'posts_per_page' => 1,'paged' => $paged,'post__in' => get_option( 'sticky_posts' ),'post__not_in' => $no_duplicates, 'ignore_sticky_posts' => 1 ) ); ?>

    In <!-- Begin categories. -->

    <?php $loop = new WP_Query( array( 'cat' => $category, 'posts_per_page' => 4, 'post__not_in' => $no_duplicates ) ); ?>

    changed in

    <?php $loop = new WP_Query( array( 'cat' => $category, 'posts_per_page' => 4, 'paged' => $paged,'post__not_in' => $no_duplicates ) ); ?>

    Then I added <?php leaf_pagination(); ?>

    before </article><!-- .post-home -->

    For this very last thing I don't know if that's the right place for you too, because I made other changes (not pagination related) removing some code. Anyway this isn't a problem.
    <?php leaf_pagination(); ?> it's a ready function included by the theme author, so just put it where you want to visualize numbers pagination, after more article section in your case.
    You must work on the child theme via FTP, and if you mess up delete the copied file in your child theme and redo over again with a new copy until you find right position with no syntax errors.

    Sorry but I don't understand the second part of your question

  9. emmykk
    Member
    Posted 11 months ago #

    thank you for sharing the codes.what i meant by my 2nd question is this;i like the pagination to be under the MORE ARTICLES section of the demo.
    such that when u click on any of the pagination square numbers 12345... ,it will display a list of colum articles like the blog,ie without fetching another fresh page with 4 latest colum display posts like your site.at http://www.bluesreviews.com

    but example of what i want at http://steadystrength.com eventhough this is not a leaf theme

  10. Alexandros.E
    Member
    Posted 11 months ago #

    Agreed with @emmykk. We really need pagination square numbers or previous pages under the more articles in the home page, something like that :

    https://mikewest.org/static_content/2010-02-pagination-pattern.png

    Thank!

  11. emmykk
    Member
    Posted 11 months ago #

    sorry i was refering to http://www.bluesreviews.it not the site i quoted b4.

  12. tizz
    Member
    Posted 11 months ago #

    @emmykk You posted a wrong URL, my site is .it not .com

    @Alexandros Leaf pagination (<?php leaf_pagination(); ?>) has that pattern more or less. The problem is that doesn't works on "columns template" when that function is added, because (I guess) the home page loop doesn't provide a post pagination.
    You can see how that code I posted works on my site, and/or you can see default leaf pagination in archives pages, e.g., or in pages with no special loop like home.
    What emmykk is asking now is different, read this topic with attention.
    If you want subsequent pages with the same "look" as the 1st one, with columns, you already have the solution.

  13. emmykk
    Member
    Posted 11 months ago #

    i miss ur site url,am sorry,advantage of a dot com,i am happy u understand what i want in the pagination.if this theme author add the pagination deficiency currently not in home page is going to be a bomb and this theme will go places.i wish a child theme with that feature is added soon,although i like the home page more than the blog page, the pagination in blog page will make me use the blog for now.but is paining me

    at tizz i like to remove the slider,how to i do that?

  14. esmi
    Forum Moderator
    Posted 11 months ago #

    People: please post your own topics.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic