Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Conditional PHP issue


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Feb 9, 2010, 06:16 PM
MyJourneytoMillions
 
46 posts · Sep 2009
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') ?> 
</p>
Why pay, use <a
href="http://www.hrblock.com/"> free tax filing </a> from H&R Block
</p>
taxes is the slug, but I also tried the cat Id which was 29. It works to put the text link where I want it but for all categories not just the taxes one.

You can check out the problem at http://www.myjourneytomillions.com

Any thoughts would be appreciated, I know I am doing something stupid
  #2  
Old Feb 10, 2010, 05:42 AM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Feb 10, 2010, 08:16 AM
MyJourneytoMillions
 
46 posts · Sep 2009
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') ?> 
Why pay, use <a
href="http://www.hrblock.com/"> free tax filing </a> from H&R Block
But it is showing up on every category archive page

So it isn't on the post page


It is on the taxes page:


But it is on another category as well:


Any thoughts?
  #4  
Old Feb 10, 2010, 09:37 AM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
you need to use IN_category not IS_category
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Feb 10, 2010, 11:21 AM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
where did you put this code?
You also mention that 'taxes' is the slug, is it a category for that post also?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Feb 10, 2010, 01:09 PM
MyJourneytoMillions
 
46 posts · Sep 2009
I put the following code:

HTML Code:
<?php in_category('29') ?> 
Why pay, use <a
href="http://www.hrblock.com/"> free tax filing </a> from H&R Block
Into Kicker Multi Post Pages

I am looking for the link to be present in only when a person is looking at the taxes category

Bookmarks

Tags
conditional, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: add IE css conditional comments byronyasgur Header configuration & styling 2 Apr 26, 2011 02:25 PM
issue: blank Central Panel - PHP code options stored with an \ ssokolenko New Versions, & Updating 3 Sep 15, 2009 05:29 PM
[SOLVED] Can't edit posts - edits vanish - Virus? Theme Issue? WP Issue? jfrenaye Atahualpa 3 Wordpress theme 1 Aug 4, 2009 07:14 AM
[SOLVED] Conditional Tag to exclude widget d_random Sidebars & Widgets 8 Jun 2, 2009 07:23 AM
How do I provide a conditional Widget in the sidebars? bgt Forum How-To 1 Jun 1, 2009 02:16 PM


All times are GMT -6. The time now is 01:46 AM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.