Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    The “no term” is one of the label settings defined when registering a taxonomy via register_taxonomy()

    Thread Starter Gerald

    (@gerital)

    Thanks for the fast answer. I tried defining “not_found” as labels option when registering the taxonomy but it doesn’t seem to be used for the 0 “No {$taxonomy}” radio button added by default.

    It works fine to disable this radiobutton but I needed to change the text of the default state to “unknown”.

    Looking in your code I found that the text comes from line 258 of class.WordPress_Radio_Taxonomy.php file and it can be changed with the language file:

    $no_term = sprintf( __( 'No %s', 'radio-buttons-for-taxonomies' ), $this->tax_obj->labels->singular_name );

    Plugin Author HelgaTheViking

    (@helgatheviking)

    Hmm… I should be using the term from the taxonomy labels. I will try to fix that when I can.

    In the meantime you can definitely filter gettext

    Plugin Author HelgaTheViking

    (@helgatheviking)

    After looking at it again, it shouldn’t be using the “not found” label as that says “Categories not found” instead of “no category” and doesn’t really make as much sense in this context.

    add_filter( 'gettext', 'change_rb4t_strings', 20, 3 );
    
    function change_rb4t_strings( $translated_text, $text, $domain ) {
    
        if( 'radio-buttons-for-taxonomies' == $domain && 'No %s' == $translated_text ){
            $translated_text = __( 'Not found', 'theme_text_domain' );
        }
    
        return $translated_text;
    }
    Thread Starter Gerald

    (@gerital)

    Thanks, that work perfectly!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change "No term"’ is closed to new replies.