WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
[resolved] Help needed with conditional statement (2 posts)

  1. caldoverde
    Member
    Posted 2 years ago #

    I've installed this plugin and it looks like it ought to do exactly what I want it to - which is to display text widgets containing menus in different languages according to post language categories - but I'm struggling to get the correct php syntax. I've been through all the examples in the plugin documentation, but I'm not getting it right - it's either not displaying the widget or it's giving me a parse error.

    What I want to say in php is ...

    is a category which is a subcategory of the category [language] OR is a single page AND in a category which is a subcategory of the category [language]

    Can any passing php wizard help me out with this please?

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

  2. caldoverde
    Member
    Posted 2 years ago #

    Solved this myself ...

    I found this plugin - Category Template Hierarchy - which adds the conditional tag is_child_of_category();

    Since there's no in_child_of_category();, I categorised all the single posts with their respective language rather than relying on the category hierarchy, giving the complete statement ...

    is_child_of_category('language') || (is_single() && in_category('language'))

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic