• I’ve spent hours trying to get this code to work and finally I have given up. is_category() without arguments just doesn’t work. I call it at the top of category.php as the docs say. Since this file is called on any click of a category url, the arguments are in the query. A work around is to call get_query_var('cat') which returns a string containing the numerical ID of the category or nothing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • What are you trying to accomplish with the function? And what have you written, code wise?

    Im thinking you want to attempt something like this:

    if (is_category('cat')) {
      code to execute if it is in category 'cat'
    }
    Thread Starter waldermort

    (@waldermort)

    I’m using it at the top of category.php which is the page that displays the category information. On this page it cannot be called with argument because they are in the query. This function is supposed to grab that query and inform us if we are infact dealing with a category request.

    The cat part is actually the query name ie ?cat=country.

    I’m still not clear on what you are trying to accomplish.

    All you want to do is display what category listing page you are on?

    Display a list of all categories?

    Thread Starter waldermort

    (@waldermort)

    I’m populating a sidebar with categories. Since the sidebar is on the main page I will allow the file heirarchy fall down to index.php where I can include the sidebar directly predefined variables telling it what to display. Because of this I need to filter out the category pages from others in the loop.

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