WordPress.org

Ready to get started?Download WordPress

Forums

Conditional Tag for Paged Comments? (4 posts)

  1. tflight
    Member
    Posted 4 years ago #

    I'm wondering if there is a conditional tag for checking to see if you are on a page that has paginated comments? I want to have the first page of comments appear under the post (like normal) however if a user clicks to page 2 or more of the comments, like http://www.example.com/example-post/comment-page-1/#comments I don't want to display the post again... only the comments. So I'm looking for a conditional tag to put into my theme so that the original post won't display again when someone flips to page 2 (or beyond) of the comments. Sure, I could check the URL for the 'comment-page-' string-- but I'm looking for a cleaner way.

  2. tflight
    Member
    Posted 4 years ago #

    If there isn't a conditional tag, does anyone have another way other than checking the URL?

  3. tflight
    Member
    Posted 4 years ago #

    I figured this one out. There is a variable called $cpage you can check. So I basically said "if $cpage < 1 display the page excerpt, else display the full page content", then the comments are displayed. This eliminates a duplicate content issue.

  4. microkid
    Member
    Posted 3 years ago #

    Thanks for sharing,

Topic Closed

This topic has been closed to new replies.

About this Topic