you can include footer42.php for post 42 by calling
<?php include("footer".$post->ID.".php") ?>
inside the loop.
Thread Starter
audrys
(@audrys)
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.
<?php include("footer".$post->ID.".php") ?>
does not equal what you did.
Using the example provided, the post wth id 42 will be looking for footer42.php
Thread Starter
audrys
(@audrys)
ok will try that but one last silly question: where do I add this code??
underneath the ‘get footer’ on page.php
Thread Starter
audrys
(@audrys)
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:
if(is_single()) {
include("footer".$post->ID.".php");
}else{
get_footer();
}
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…