Conditional PHP issue
I want to add a text link above the title of the posts in a specific category, so I searched the forums and found some great stuff so I used the code
HTML Code:
<?php is_category('taxes') ?> You can check out the problem at http://www.myjourneytomillions.com Any thoughts would be appreciated, I know I am doing something stupid |
This will explain it:
is_category() - When any Category archive page is being displayed. is_category('9') - When the archive page for Category 9 is being displayed. in_category('5') - Returns true if the current post is in the specified category id. read more |
JD,
Thanks for the response, I saw that on Codex but still couldn't figure it out. I used the following code HTML Code:
<?php is_category('29') ?> So it isn't on the post page http://www.myjourneytomillions.com/post.png It is on the taxes page: http://www.myjourneytomillions.com/taxes.png But it is on another category as well: http://www.myjourneytomillions.com/wrong.png Any thoughts? |
you need to use IN_category not IS_category
|
where did you put this code?
You also mention that 'taxes' is the slug, is it a category for that post also? |
I put the following code:
HTML Code:
<?php in_category('29') ?> I am looking for the link to be present in only when a person is looking at the taxes category |
you need an IF and a closing '?>' to end the php so your statement will be
HTML Code:
<?php if (in_category('29')) { |
All times are GMT -6. The time now is 04:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.