WordPress.org

Support

Support » How-To and Troubleshooting » How to use comments with pagination?

How to use comments with pagination?

  • 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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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.

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

    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).

    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?

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to use comments with pagination?’ is closed to new replies.
Skip to toolbar