Some members may want to add html to their CPT custom field drop down to highlight a choice. This is not possible, but you can do a ‘string replace’ to find some text and replace it with some html. Here’s an example using the field ‘myDropDown’ to add tags to the words ‘BOLD ME’.

// Filter geodir_myDropDown field content.
function _gd_custom_customize_myDropwDown( $html, $location, $cf, $p = 0 ) {
    if ( ! empty( $html ) && ! empty( $cf['htmlvar_name'] ) && $cf['htmlvar_name'] == 'geodir_myDropDown' ) {
        $html = str_replace( ' BOLD ME ', ' <strong>BOLD ME</strong> ', $html );
    }

    return $html;
}
add_filter( 'geodir_custom_field_output_select', '_gd_custom_customize_myDropDown', 100, 3 );

Please log in to rate this.
0 people found this helpful.


Category: Customizing your GeoDirectory site

← FAQs