Support » Installing WordPress » Calling a different footer for each page
9 years, 7 months ago
hi is it possible to call a different footer for each post. lets say post 42 needs footer1.php thanks
you can include footer42.php for post 42 by calling
<?php include("footer".$post->ID.".php") ?>
inside the loop.
hmm.. I added the above code into my page.php right below ‘get footer’ and page didn’t load. can you please please give me a working example
<?php include(“footer1″.$post->42.”.php”) ?>
and how about catagories ??
want you to know that I have several different footers that I’d like to place with a particular post or cat
you didnt use what he provided..
what he provided uses the same numbered footer for the same number post.
does not equal what you did.
Using the example provided, the post wth id 42 will be looking for footer42.php
ok will try that but one last silly question: where do I add this code??
underneath the ‘get footer’ on page.php
and also how to apply when I am calling for category like ?cat=42
In fact, you cannot use get_footer anymore. Just use the code I provided instead.
To get another footer for your category, you must use the causal tags someho like this:
This will include the post-specific footer (footerX.php) for every post, and a common footer (footer.php) for every other page/category/search…
And a note: you do NOT add it to the page.php – that file is to display Pages not posts.
Reading about the Template_Hierarchy is always useful…