Forums

Taxonomy Widget
[resolved] Change 'Please Choose' (8 posts)

  1. loomeinimene
    Member
    Posted 1 year ago #

    It would be nice if I could change 'Please Choose' text to something else :)

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

  2. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Great idea. I added this to the latest release + fixed a few minor issues with WP_DEBUG set to true. As of version 0.3, you can now filter the text. Here are a few examples:

    /**
     * Filter dropdown text for all taxonomies.
     */
    add_filter( 'taxonomy-widget-show-option-none', 'mytheme_show_options_none' );
    function mytheme_show_options_none( $text ) {
    	return 'Custom text for all taxonomies.';
    }
    /**
     * Filter dropdown text for the category taxonomy.
     */
    add_filter( 'taxonomy-widget-show-option-none-category', 'mytheme_show_options_none_category' );
    function mytheme_show_options_none_category( $text ) {
    	return 'Custom category text.';
    }
    /**
     * Filter dropdown text for the post_tags taxonomy.
     */
    add_filter( 'taxonomy-widget-show-option-none-post_tag', 'mytheme_show_options_none_tags' );
    function mytheme_show_options_none_tags( $text ) {
    	return 'Custom tag text.';
    }
  3. loomeinimene
    Member
    Posted 1 year ago #

    Sweet :D
    But if I am using 2 or more Taxonomy widgets on page, how to give each a different 'Please Choose' text?

  4. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Do you have 2 dropdowns for the same taxonomy on one page?

  5. loomeinimene
    Member
    Posted 1 year ago #

    No. I have 2 dropdowns for separate taxonomys.

  6. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Right on. Looks at the bottom two code snippets in my post above. One changes only categories while the other changes only tags. You can use the same type of filter for any custom taxonomy that you have set up. The filter slug is dynamic:

    'taxonomy-widget-show-option-none-taxonomy-name'

  7. loomeinimene
    Member
    Posted 1 year ago #

    Oh, got it :D
    Thanks for fast responds!

  8. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    No problem. Please mark thread as resolved if this solved your problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic