Hi,
I would like the ability to automatically add certain text/images/links to the end of posts based on the category they are in. For example in one category I want to add a copyright notice and at the end of another a disclaimer.
Does anybody know of such a plugin? WOuld anybody be willing to create one?
TIA
kdmurthy
Member
Posted 5 years ago #
What is supposed to happen when a post belong to multiple categories?
-- KD
It would add both mini footers.
kdmurthy
Member
Posted 5 years ago #
I dont know of any available plugins - but it will be trivial to get this up. You can use the category description field to add the blurb you want for each category.
At the end of your post add code similar to this:
<?php
foreach((get_the_category()) as $cat) {
echo $cat->category_description;
} ?>
Hope this helps.
-- KD
Thanks for the Solution. Unfortuantely I use the cat desctiption already and it doesn't contain the type of text I would like. However, if tis is the only way (And your solution is very simple) then I may have to re-think things. Thank you.
I think you're looking for in_category, which is used inside the loop:
http://codex.wordpress.org/Template_Tags/in_category
This looks like it could work. Thank you for the link.