WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Exec-PHP] Code not executed in a widget but ok when hard coded

[Plugin: Exec-PHP] Code not executed in a widget but ok when hard coded

  • ouranos2
    Member

    @ouranos2

    I want to display subcategories of current category in a widget. So i tested exec-php and “exec-php / hello world” works fine.

    The code I’m using (see below) works fine when hard-coded in the sidebar, but doesn’t display anything when i put it in a text widget.

    I tried with no other active plugin, same result …

    You can see the two widgets and the hard-coded result here, at the bottom of the sidebar.
    http://www.xarax.fr/wpfsc4/rubrique/democratisation-de-la-science/

    Any idea ? Thanks.

    <?php
    if (is_category()) {
      $this_category = get_category($cat);
      if (get_category_children($this_category->cat_ID) != "") {
        wp_list_categories('orderby=id&show_count=0&title_li=
    &use_desc_for_title=1&child_of='.$this_category->cat_ID);
        }
    }
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Exec-PHP] Code not executed in a widget but ok when hard coded’ is closed to new replies.