Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here's the scenario, I'm working on a site with 100s of of paged posts using the wp_link_pages tag.

The issue I'm having is that they're things I want displayed on the main post that I don't want display of the paged parts of the post and vice versa.

How can I achieve that? And is it possible to give the paged parts of a post their own template?

share|improve this question
    
so you want to display your "things" on the first page of all the posts? not on 2nd/third pages? –  Towfiq Feb 5 at 13:33
    
@Towfiq Yeah, they're things in the single.php template that I only want to show up on the main page of the post and not on the 2nd, 3rd, 4th etc. Which is why I was wondering if it's possible to the the 2nd, 3rd pages their own template. –  Chozen Feb 5 at 13:42

2 Answers 2

up vote 1 down vote accepted

In your single.php add this example code inside the loop:

<?php 
    global $page;
    if ($page == 1) {?>
    <div style="color:red;">This text should only appear on first page of the post!!!</div>
<?php } ?>

you can change the div with your thing that you wanted to display only on the first post page..

share|improve this answer
    
Yup, that worked like a charm. Thanks a lot. –  Chozen Feb 5 at 14:57

Unfortunately there is no fork in Template Hierarchy to template paginated posts differently (there is one for paginated archives).

If you at wp_link_pages() source it uses number of global variables to distinguish state of paginated post:

global $page, $numpages, $multipage, $more;

You would need to work with these directly to conditionally adjust content or markup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.