WordPress.org

Support

Support » Plugins and Hacks » [Plugin: My Custom Widgets] Bugs

[Plugin: My Custom Widgets] Bugs

Viewing 3 replies - 1 through 3 (of 3 total)
  • Please read the manual. You can enter checks on both (categories and tags) on the setting page (NOT on the Appearance page).

    Will this let you filter between different categories?
    (i.e. if (is_Category(‘entertainment’)) { )

    janekniefeldt

    @janekniefeldt

    This should work. But I am not sure if this will cover what you want to do, because it will not cover single posts.

    Another comment I recently posted on my homepage:

    The tag “is_tag(’love’)” would return true if you are watching the archive entry for the love tag (usually by clicking on “love” in your tag cloud).

    So this will not work for single posts. To get a list of all tags that are assigned to a post, you should use the get_the_tags function (function reference: http://codex.wordpress.org/Function_Reference/get_the_tags)

    This means that the filters provided by this plugin will not help you. But you can use this code (simply add it to your html-widget)

    <?php
    if (is_single());
    $all_post_tags = get_the_tags();
    foreach($all_post_tags as $this_tag) {
    if ($this_tag->name == “love” ) {
    ?>
    <!– insert your html-content here –>
    <?php
    }
    }
    ?>

    This example handles tags but should work for categories too (if you change the coding accordingly (replace is_tag with is_category)).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: My Custom Widgets] Bugs’ is closed to new replies.
Skip to toolbar