• teeboy4real

    (@teeboy4real)


    Hello,

    I use the DTD snippet for both category and location but I dont want to add labels above the select box but use a placeholder to describe the input select box. Currently while using DTD for both category and location selection the select box is totally blank, there should at least be a placeholder text like (Select category) or (Select location). Its quite odd that while using the Custom fields addon a placeholder was included but it does not show at all.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the DTD options are loaded with AJAX and they do not have to the Custom Fields from scheme so cannot use the placeholder from your CF configuration.

    To force the placeholder on DTD you would need to open file dependant-taxonomy-dropdown.php go to line about 269 and replace

    
    adverts_field_select( array(
        "name" => $taxonomy . '_' . $i,
        "empty_option" => true,
        "empty_option_text" => "",
        "options" => $options,
        "class" => "",
        "value" => $selected
    ) );
    

    with something like

    
    if( adverts_request( "taxonomy" ) == "advert_category" ) {
        $eot = "Select Category ..."; 
    } else {
        $eot = "";
    }
    adverts_field_select( array(
        "name" => $taxonomy . '_' . $i,
        "empty_option" => true,
        "empty_option_text" => $eot,
        "options" => $options,
        "class" => "",
        "value" => $selected
    ) );
    
    Thread Starter teeboy4real

    (@teeboy4real)

    Thanks this worked for only advert category How can I apply it to advert location.
    The second placeholder should be advert location.

    I am using the maps and location addon but my setting is saved at (Use dropdown filled with Location taxonomy).

    Plugin Author Greg Winiarski

    (@gwin)

    To apply this to other taxonomies as well you need to expand the “if” statement

    
    if( adverts_request( "taxonomy" ) == "advert_category" ) {
        $eot = "Select Category ..."; 
    } else if( adverts_request( "taxonomy" ) == "advert_location" ) {
        $eot = "Select Location ...";
    } else {
        $eot = "";
    }
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘DTD placeholder’ is closed to new replies.