• I’m trying to set up a category-specific CSS file with in_category, and, oddly, it’s not working. The error comes out like this:
    Warning: Invalid argument supplied for foreach() in /home/plaincul/public_html/jon/wp-includes/template-functions-category.php on line 446
    Warning: in_array(): Wrong datatype for second argument in /home/plaincul/public_html/jon/wp-includes/template-functions-category.php on line 450
    I’ve tried using these:
    if(in_category(4)) { blah }
    if(in_category(‘4’)) { blah }
    if(in_category(‘Journal’)) { blah }
    and they all come out with the same answer (the errors above). Any fix for this? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Why the misleading thread title? It ain’t broke. Did you follow Matt’s instructions on how to implement it?

    Thread Starter jonthejester

    (@jonthejester)

    In all truth, not exactly… Although the exact same function call (I think it is) works in WP 1.2, for a friend’s site I’m helping to build. So where are Matt’s instructions again?

    Thread Starter jonthejester

    (@jonthejester)

    Forgive my ignorance, but what’s the variable for multiple posts?
    $single = Single posts
    $mult = Multiple posts?
    Thanks so much.

    !$single

    Thread Starter jonthejester

    (@jonthejester)

    Maybe it’s my embarissing scant knowledge of PHP, but I tried changing the line if($single) to if(!$single) and it spit out this:
    Warning: Invalid argument supplied for foreach() in /home/plaincul/public_html/jon/wp-content/themes/simplicity-04/category.php on line 5
    Rats… What else should I change in that code snippet?

    Thread Starter jonthejester

    (@jonthejester)

    Doh, stupid me… I haven’t updated my blog since upgrading to 1.3 (From 1.2)… *sigh* Common sense really humbles me… Thanks guys, really sorry about that. ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘in_category() broken’ is closed to new replies.