Did you know, by default, using a featured image on a post that is broken down into parts will display that featured images on each page/part of that post? For most themes this is the case … but what if you don’t want the featured image on each part of the post? That’s what we’re talking about here …

First off, there are a couple of things that need to happen. The theme is providing support for featured images (in posts, pages, etc.); and, the post has been broken down into parts (or pages) using the WordPress core <!–nextpage–> marker and the wp_link_pages() function.

Here’s the basics, as it applies to post templates (similar code could be used in page templates), such as index.php, single.php, etc.

You’re going to need a callback function:

<br />
/**<br />
 * Post Is Paged<br />
 *<br />
 * @param array $haystack the body classes.<br />
 *<br />
 * @return bool|int<br />
 */<br />
function post_is_paged( $haystack ) {<br />
	$needle = 'paged';</p>
<p>	return ( strpos( $haystack, $needle ) );<br />
}<br />

The callback function will be used here:

$post_is_paged = array_filter( get_body_class(), 'post_is_paged' );

Then you can use a conditional check on the $post_is_paged variable such as this:

<br />
if ( ! $post_is_paged ) {<br />
	/** Create output to be displayed on the first page. */<br />
} else {<br />
	/** Create output for the second (or later) page of the post. */<br />
}<br />

That’s it … although I’m sure it could be better written, it does work; and, it will be part of the next theme I publish.