0

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?

  • so you want to display your "things" on the first page of all the posts? not on 2nd/third pages? – Towfiq Feb 5 '14 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 '14 at 13:42
1

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..

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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