WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] If is comment paged ?

[Resolved] If is comment paged ?

  • Hi all!

    Ok, here is my question :

    I know the conditional tag “is paged”…

    I wonder if there is a similar condition for comment pages…

    Something like : if is comment paged

    I would like to display something if we are currently on a comment page

    domain.tld/permalink-to-post/comment-page-1/

    Am I clear ? 🙂

    Thanks!

    S.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Example to output comment page number:
    echo get_query_var('cpage');

    If it doesn’t return a value, then you can assume it’s the first page..

    Can handle the var in the same way as paged… if you want to use it for something..

    Further example:

    $comment_paged = ( get_query_var('cpage') && get_query_var('cpage') > 1 ) ? get_query_var('cpage') : 1;

    Nice nice nice…

    Here is what I did based on your suggestion :

    <?php
    $page_comment = get_query_var('cpage');
    if ($page_comment > 0) {
    echo 'comment page : '.$page_comment;
    }
    ?>

    For anyone searching this forum in the future, I was looking for a solution to add the page comment number in the <title> tag in my header, to avoid “double <title> tags” in search engine indexation…

    Another resolved issue! Thanks

    S.

    You’re welcome..

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] If is comment paged ?’ is closed to new replies.