Support » Fixing WordPress » How to identify a page, on a multipage post?

  • Is there a way, using conditional statements, to identify what page I’m on in a multipage post? I’m not talking about a PAGE page, but a section of a post that was broken up. I’m trying to make the background change depending on what page of the post the viewer is on.

Viewing 1 replies (of 1 total)
  • $wp_query->query[paged]
    ( variable will not be defined when on page 1) value on page 2 will be ‘2’ as a string

    if(!$wp_query->query[paged]) {
     // on page 1 - page 1 code here
    } elseif ($wp_query->query[paged] == 2) {
      // on page 2
    } elseif ($wp_query->query[paged] == 3) {
      // on page 3
    }
Viewing 1 replies (of 1 total)
  • The topic ‘How to identify a page, on a multipage post?’ is closed to new replies.