Forums

[resolved] Assign to several categories (4 posts)

  1. kjetilgf
    Member
    Posted 3 years ago #

    Hi
    Just can't find this:
    To make something show up in specific categories, I've tried this code - but what is wrong?
    Thanks a lot for any hints,
    Kjetil
    'is_category(4,5,6,8,9,10,11,13,16,21)'
    or - also on the categories' sub-pages: 'is_category(4,5,6,8,9,10,11,13,16,21) || (is_single() && in_category(4,5,6,8,9,10,11,13,16,21))'

  2. kjetilgf
    Member
    Posted 3 years ago #

    Any hints? Maybe a links?
    ... :o)

  3. moshu
    Member
    Posted 3 years ago #

    Maybe reading the documentation...? Is that a good hint?
    http://codex.wordpress.org/Conditional_Tags#A_Category_Page

  4. kjetilgf
    Member
    Posted 3 years ago #

    Thanks Moshu
    That was the link I couldn't find, or - actually - that page contains a link to the crucial explanation.
    The necessary code to make eg a widget show up only on these categories' pages (by the use of the Widget Logic plugin) is:

    in_category(4) || in_category(5) || in_category(6) || in_category(8) || in_category(9) || in_category(10) || in_category(11) || in_category(13) || in_category(16) || in_category(18) || in_category(21)

    -

    is_category(4,5,6,8,9,10,11,13,16,21)

    is not allowed, it says.
    Thanks,
    Solved.

Topic Closed

This topic has been closed to new replies.

About this Topic