Viewing 6 replies - 1 through 6 (of 6 total)
  • before line 23, there seems to be another closing curly bracket } missing.

    Thread Starter peterspliid

    (@peterspliid)

    Thank you! that fixed the error. It does however not work as i wanted. When I go to the sports page (category 13), it shows the nightlife slide (category 8), but all the posts in the sports category seem to work as well as everything else. How can that be?

    Thanks

    WordPress doesn’t have an in_category() function. Unless it’s a custom function, you’re probably wanting is_category():

    Function Reference/is category

    there is the build-in in_category() conditional tag: http://codex.wordpress.org/Function_Reference/in_category

    however, this will only work in single posts;

    if your code snippet is in a category archive page, then you should use is_category() – if it is in a single.php template, or used within the loop, then in_category() should work.

    as you posted only an isolated piece of coding, nobody can know…

    Whoops! My bad. I blame all my failings on Google. :p

    I blame all my failings on Google

    accepted – I have the same ‘problem’ – google is not too familiar with the in_category() tag and always tries to pretend it is a typing mistake 😉

    hope this somehow helps the questioner to solve the problem …

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Need basic php help with if/elseif’ is closed to new replies.