Title: Article with Multiple Pages!!
Last modified: August 19, 2016

---

# Article with Multiple Pages!!

 *  [Vietson](https://wordpress.org/support/users/limited/)
 * (@limited)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/article-with-multiple-pages/)
 * Hi everyone,
 * I have a few articles that are broken into multiple pages using the <!–nextpage–
   > tag. I also have an image header which I use on every post through custom field.
 * My question is, how do I change the image header to a different one if the article
   is on page 2 or 3?
 * Is there a condition that I could use? I looked at page, paged, and numposts 
   but I couldn’t get any to work correctly.

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

 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/article-with-multiple-pages/#post-942119)
 * This checks if it’s paged:
 *     ```
       <?php
   
       global $wp_query;
   
       if((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
   
       // Do something if paged
   
       }
   
       ?>
       ```
   
 *  Thread Starter [Vietson](https://wordpress.org/support/users/limited/)
 * (@limited)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/article-with-multiple-pages/#post-942201)
 * Thanks for the reply. I was able to get the code working for page 2, and so on,
   but I couldn’t get it to work for page 1.
 * Here’s the code I have…
 *     ```
       <?php
       	if	(( ($page = $wp_query->get('paged')) || ($page = $wp_query->get('page')) ) && $page == 1 && get_post_custom_values("img"))	{ /* Display Image Header 1*/ }
       	elseif	(( ($page = $wp_query->get('paged')) || ($page = $wp_query->get('page')) ) && $page == 2 && get_post_custom_values("img2")) 	{ /* Display Image Header 2*/ }
       	elseif	(( ($page = $wp_query->get('paged')) || ($page = $wp_query->get('page')) ) && $page == 3 && get_post_custom_values("img3")) 	{ /* Display Image Header 3*/ }
       ?>
       ```
   
 *  Thread Starter [Vietson](https://wordpress.org/support/users/limited/)
 * (@limited)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/article-with-multiple-pages/#post-942223)
 * Ahh, I finally got it to work.
 *     ```
       <?php
       	if	(( ($page = $wp_query->get('paged')) || ($page = $wp_query->get('page')) ) && $page == 2 && get_post_custom_values("img2")) { /* Get Img 2 */ }
       	elseif	(( ($page = $wp_query->get('paged')) || ($page = $wp_query->get('page')) ) && $page == 3 && get_post_custom_values("img3")) { /* Get Img 3 */ }
       	elseif	(get_post_custom_values("img")) { /* Get Img */ }
       ?>
       ```
   

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

The topic ‘Article with Multiple Pages!!’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Vietson](https://wordpress.org/support/users/limited/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/article-with-multiple-pages/#post-942223)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
