Title: Styling multiple-page posts
Last modified: August 19, 2016

---

# Styling multiple-page posts

 *  Resolved [pj](https://wordpress.org/support/users/psinco/)
 * (@psinco)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/)
 * In single posts that I divided into multiple pages using <!–nextpage–>, I would
   like to style the extra pages differently. I probably need to use a conditional
   tag in the Loop, but I can’t figure out how WordPress distinguishes the remaining
   pages in a multi-page post from the opening post page. In other words, I don’t
   know how WordPress knows it’s on Page 3 of a long post rather than on Page 1.
   I want Page 2, Page 3, etc., to look slightly different than Page 1.
 * Does anyone have any suggestions on how to accomplish this?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215297)
 * One way to do this would be to wrap the contents of page2 in a div and assign
   a class of page2. Then you can assign CSS styling in your stylesheet to override
   the default styling of page2, page3, etc. You’d assign those classes on the editor’s
   HTML tab.
 *     ```
       <!--nextpage-->
       <div class="page2>
       <h2>Page 2 content goes here</h2>
       <p>some text</p>
       </div>
   
       <!--nextpage-->
       <div class="page3>
       <h2>Page 3 content goes here</h2>
       <p>some text</p>
       </div>
       ```
   
 * stylesheet:
 *     ```
       #content .page2 p { color: #123456; margin-top: 20px; }
       #content .page3 p { color: #654321; margin-top: 10px; }
       ```
   
 *  [robbono](https://wordpress.org/support/users/robbono/)
 * (@robbono)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215377)
 * I have the same question. There is a bug in WordPress that causes the_content
   not to work properly in sidebars after pagination (i.e., the_content() works 
   in sidebars on page 1 of a paginated post, but not on subsequent pages 2, 3, 
   4, 5, etc).
 * Because of this, I want to disable a sidebar block based on whether or not it’s
   the first page of a paginated post. Therefore, the aforementioned solution (for
   styling purposes) will not work for me.
 * WordPress has some way of knowing what page it is – some kind of property. What
   is this property, and how can I create a conditional statement using it?
 * Thanks!
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215389)
 * [@robbono](https://wordpress.org/support/users/robbono/):
    When on the 1st page
   of paginated post, this variable will not exist: `$wp_query->query_vars['page']`
 * When on the second page its value will be “2”.
 * you can test for 1st page with
    `if ( isset($wp_query->query_vars['page'] ))`
   if it returns false you are on the 1st page.
 *  [robbono](https://wordpress.org/support/users/robbono/)
 * (@robbono)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215396)
 * Great! At least if I can’t fix the sidebar the_content() bug, I can disable the
   block in question on the 2nd and later posts. Thanks again!
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215401)
 * I don’t know what you are after, but I just displayed post content that is displayed
   in the main post area, in the sidebar, on all pages of a paginated post with `
   echo $post->post_content`
 * However it’s the full content, not paged. It would have to be run through some
   filters to page it.
 * If you are trying to display posts in the sidebar, you are better off using a
   custom WP query – see
    [http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/](http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/)
 *  Thread Starter [pj](https://wordpress.org/support/users/psinco/)
 * (@psinco)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215474)
 * > you can test for 1st page with
   >  if ( isset($wp_query->query_vars[‘page’] ))
   > if it returns false you are on the 1st page.
 * This works beautifully. Thank you for the great suggestions.
 *  [robbono](https://wordpress.org/support/users/robbono/)
 * (@robbono)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215595)
 * [@stvwlf](https://wordpress.org/support/users/stvwlf/) – Yep, I could use $post-
   >post_content, but what I’m trying to display is a poll using WP-Polls – so the
   content only displays as [poll-id: 8], which triggers WP-Polls to display the
   poll. It only works when it’s run through the_content(), not when echoed as a
   variable. My knowledge of filters doesn’t go far enough for me to figure out 
   how to get it to trigger WP-Polls plugin, so I’m just going to have to hide the
   block until the sidebar issue is fixed.
 * BTW, I’m using a custom WP-Query, but there’s a reported bug with WordPress not
   clearing out globals on the 2nd page (even when using wp_reset_query() ), so 
   no matter what I do, the_content() always displays the wrong content – but that’s
   a topic for another post.
 * Thanks again for the conditional advice! I’ll be using that for now!
 *  [Michael Soriano](https://wordpress.org/support/users/mks6804/)
 * (@mks6804)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215663)
 * > you can test for 1st page with
   >  if ( isset($wp_query->query_vars[‘page’] ))
   > if it returns false you are on the 1st page.
 * so there is no function to determine if a post is on the paginated page. not 
   like is_paged();
 *  [hkalant](https://wordpress.org/support/users/harryplusk/)
 * (@harryplusk)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215716)
 * Hello,
    Can I change the way numbers are showing up in multi-page posts in Twenty
   Ten theme? I can’t find the piece of CSS code that is responsible for that. (
   I would like to remove the grey background and use some border-radius for the
   corners.) thnx.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Styling multiple-page posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 5 participants
 * Last reply from: [hkalant](https://wordpress.org/support/users/harryplusk/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/styling-multiple-page-posts/#post-1215716)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
