Writing functions in functions.php
-
I’m beginning my foray into writing my own php functions and I’ve basically got it down, but when I try and add the functions into the functions.php file instead of directly into a template, they often don’t work.
For example, I tried creating this function:
function cn_parentcat ( ) { if (is_category('8')) { echo ('fubar');} }
If I add the if statement directly to a template (category.php in my case), a-okay. But it’s a no-go in functions.php.
Is there some query (or something else) I need to pass before I can perform certain actions like this?
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Writing functions in functions.php’ is closed to new replies.