Home > WordPress > How to Remove Unordered List Bullet in Output of Custom Field Template Plugin of WordPress

How to Remove Unordered List Bullet in Output of Custom Field Template Plugin of WordPress

A few days ago, I used Custom Field Template plugin in my another website that I created by using WordPress. This plugin is useful if you want to define the custom field in your posts or pages, especially if you want to use the frequently templates which have the fixed data field entry. Unfortunately, when the related template is being displayed, you will see the unordered list bullet in the leftside of each item inside the html table. So I made modification in order to remove this unordered list bullet. Also, this modification will add the ability for user to move to the next field while entering data in edit/add mode by using Tab from the keyboard.

  1. Open your /wp-content/plugins/custom-field-template/custom-field-template.php file, and find this code:
    2611
    2612
    2613
    2614
    2615
    
    $output = '<ul>' . "\n";
    foreach ( $metavalue as $val ) :
    	$output .= '<li>' . $val . '</li>' . "\n";
    	endforeach;
    $output .= '</ul>' . "\n";

    then replace with this following code:

    2611
    2612
    2613
    2614
    2615
    
    $output = '' . "\n";
    foreach ( $metavalue as $val ) :
    	$output .= '' . $val . '' . "\n";
    	endforeach;
    $output .= '' . "\n";
  2. Find again this code:

    2758
    
    foreach( $replace as $rkey => $rval ) :

    then replace with this following code:

    2758
    2759
    
    $x = 0;
    foreach( $replace as $rkey => $rval ) :
  3. Find again this code:

    2767
    
    $replace_val[$rkey] .= '<input type="text" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0]) . '"' . $class . ' />';

    then replace with this following code (this code will have the ability to define the tabindex in each field in order to make you easier while inputing the data entry):

    2767
    
    $replace_val[$rkey] .= '<input type="text" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0]) . '"' . $class . ' tabindex="'.$x.'" />';
  4. Find again this code:

    2782
    
    $replace_val[$rkey] .= '<ul' . $class . '>';

    then replace with this following code:

    2783
    
    $replace_val[$rkey] .= '';
  5. Find again this code:

    2797
    2798
    2799
    2800
    2801
    2802
    2803
    2804
    2805
    2806
    2807
    
    $replace_val[$rkey] .= '<li><label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metavalue) . '"' . $class . $checked . '  /> ';
    if ( $valueLabel[$j] ) $replace_val[$rkey] .= stripcslashes($valueLabel[$j]);
    else $replace_val[$rkey] .= stripcslashes($metavalue);
    $replace_val[$rkey] .= '</label></li>';
    	$j++;
    endforeach;
    $replace_val[$rkey] .= '</ul>';
    else :
    if ( $_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0] == attribute_escape(trim($values[0])) )
    $checked = ' checked="checked"';
    $replace_val[$rkey] .= '<label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape(trim($values[0])) . '"' . $class . $checked . ' /> ';

    then replace with this following code:

    2797
    2798
    2799
    2800
    2801
    2802
    2803
    2804
    2805
    2806
    2807
    
    $replace_val[$rkey] .= '<label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metavalue) . '"' . $class . $checked . ' tabindex="'.$x.'" /> ';
    if ( $valueLabel[$j] ) $replace_val[$rkey] .= stripcslashes($valueLabel[$j]);
    else $replace_val[$rkey] .= stripcslashes($metavalue);
    $replace_val[$rkey] .= '</label>';
    $j++;
    endforeach;
    $replace_val[$rkey] .= '';
    else :
    if ( $_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0] == attribute_escape(trim($values[0])) )
    $checked = ' checked="checked"';
    $replace_val[$rkey] .= '<label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape(trim($values[0])) . '"' . $class . $checked . ' tabindex="'.$x.'" /> ';
  6. Find again this code:

    2835
    
    $replace_val[$rkey] .= '<li><label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metavalue) . '"' . $class . $checked . ' /> ';

    then replace with this following code:

    2835
    
    $replace_val[$rkey] .= '<li><label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metavalue) . '"' . $class . $checked . ' tabindex="'.$x.'" /> ';
  7. Find again this code:

    2845
    
    $replace_val[$rkey] .= '<label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][]" value="' . attribute_escape(trim($values[0])) . '"' . $class . $checked . ' /> ';

    then replace with this following code:

    2845
    
    $replace_val[$rkey] .= '<label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][]" value="' . attribute_escape(trim($values[0])) . '"' . $class . $checked . ' tabindex="'.$x.'" /> ';
  8. Find again this following code:

    2861
    
    $replace_val[$rkey] .= '<select name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]"' . $class . '>';

    then replace with this following code:

    2861
    
    $replace_val[$rkey] .= '<select name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]"' . $class . ' tabindex="'.$x.'">';
  9. Find again this code:

    2881
    2882
    
    	endswitch;
    endforeach;

    then replace with this following code:

    2881
    2882
    2883
    
    	endswitch;
    	$x++;
    endforeach;
  • Share/Bookmark
86 views Print This Post Print This Post