WordPress.org

Support

Support » Plugins and Hacks » is_category() does not work

is_category() does not work

  • Hi, I like your plugin very much. But one thing does not work. If I use e.g. is_single(array(3,112,17,55) it works. But if I use is_category(array(5,9,10,11) it does not work, nothing appears on sidebar. Why?

    I have another question. Is it possible to use several codes e.g. is_category(array(5,9,10,11) <u>and</u> is_page(array(3,112,17,55) for one widget? How is the correct syntax?

    Using Version Widget Logic 0.55 and WordPress 3.52
    Link: http://www.anbieter-vergleichen.de/blog.html

    http://wordpress.org/plugins/widget-logic/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Michael

    @alchymyth

    Forum Moderator

    if I use is_category(array(5,9,10,11) it does not work, nothing appears on sidebar

    unless your code here in teh forum is a typing eror, the correct syntax would need another closing bracket:

    is_category(array(5,9,10,11))

    this also only targets category archive pages, not single posts with those categories.

    http://codex.wordpress.org/Conditional_Tags

    Is it possible to use several codes e.g. is_category(array(5,9,10,11) and is_page(array(3,112,17,55) for one widget?

    an AND operation would never result in true; if you mean to use OR, try:

    ( is_category( array(5,9,10,11) ) || is_page( array(3,112,17,55) ) )

    O.k. I understand my mistake. It will only show widget on category view, not the included posts. So I have to use in_category(array(5,9,10,11))

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_category() does not work’ is closed to new replies.