WordPress.org

Ready to get started?Download WordPress

Forums

How to use comments with pagination? (6 posts)

  1. fabricio.s
    Member
    Posted 2 years ago #

    I use pagination in my site, i.e., each article can have several pages. I don't know how to use the comments area (I use Disqus plugin). If I allow comments, they are showed in all the pages, but I'd like to show them only after the whole article. Can I do that?

  2. patv
    Member
    Posted 2 years ago #

    Can you display your code for pagination? You can use the following query:

    $wp_query->get( 'paged' )

    to get the current pagination index (if not already retrieved manually, which you should already have in theory i believe) and the following query:

    $wp_query->max_num_pages

    will return the maximum pagination value. Check if these two values match, and if so perform your comments call. If not, don't retrieve the comments.

  3. fabricio.s
    Member
    Posted 2 years ago #

    Sorry, patv. I'm a beginner at WordPress and I didn't understand what you said. Could you kindly explain better? Thanks.

  4. patv
    Member
    Posted 2 years ago #

    the first code I sent you will retrieve the current pagination index for your post listing. For example, if it's the 2nd page of your post, it will return 2. If you have your post set up in 3 pages, the second code will give you the max number of pages for your post, so 3.

    By comparing these two variables, you will be able to detect if you are at your last page of your post (when the current page index is equal to the maximum index).

  5. fabricio.s
    Member
    Posted 2 years ago #

    Patv, I think we are thinking in different things.

    I don't have problem to know if I am at the 1st page, the 2nd page, etc. because I can see the line that divides the pages.

    However, I think Disqus doesn't allow me to choose the position of the comments area. I can only set it on (appearing in all the pages) or set it off (appearing in none).

    I'd like to activate Disqus just at the last page. Do you know how I could do that?

  6. patv
    Member
    Posted 2 years ago #

    Do you have a link your website so i can see what you're talking about? I think I might be getting lost in the explanations.

Topic Closed

This topic has been closed to new replies.

About this Topic