// ShortCode
add_action( ‘init’, ‘dcms_frm_shortcode’ );
function dcms_frm_shortcode(){
add_shortcode(‘search-form’, ‘dcms_search_form’);
}
function dcms_search_form( $atts , $content ){
global $wpdb;
$search = $_GET[‘search’]??”;
$table_name = ‘customers’;
$field_search1 = ‘customerNumber’;
$field_search2 = ‘customerName’;
if ( $search ){
$sql = “SELECT * FROM {$table_name}
WHERE {$field_search1} = ‘{$search}’ OR $field_search2 LIKE ‘%{$search}%'”;
$items = $wpdb->get_results($sql);
}
?>
Número | Nombre | Tel | Dirección | País | Crédito |
---|---|---|---|---|---|
= $item->customerNumber ?> | = $item->customerName ?> | = $item->phone ?> | = $item->addressLine1 ?> | = $item->city ?> | = $item->creditLimit ?> |
No se encontraron resultados