• Hi there,`

    Is there a conditional function that would rename the option value ‘select subcategory’ if a specific term selected?

    there is the php code that display the subcategory:

    echo '<br /><span id="sub_cats">';
    if(!empty($cat[1]->term_id))
    {
    $args2 = "orderby=name&order=ASC&hide_empty=0&parent=".$cat[0]->term_id;
    $sub_terms2 = get_terms( 'auction_cat', $args2 );
    $ret = '<select class="do_input" name="subcat">';
    $ret .= '<option value="">'.__('Select Subcategory','AuctionTheme'). '</option>';
    $selected1 = $cat[1]->term_id;
    foreach ( $sub_terms2 as $sub_term2 )
    {
    $sub_id2 = $sub_term2->term_id;
    $ret .= '<option '.($selected1 == $sub_id2 ? "selected='selected'" : " " ).' value="'.$sub_id2.'">'.$sub_term2->name.'</option>';
    }
    $ret .= "</select>";
    echo $ret;																																				}
    echo '</span>';

    In human readable format, I was expecting to do something like this:

    If University category selected, rename ‘select subcategory’ to ‘select grades’

    Any help will be appreciated, Thanks in advance

  • The topic ‘How to rename my subcategory’ is closed to new replies.