الباحثين

// إنشاء shortcode لعرض البيانات add_shortcode('display_custom_data', 'display_custom_data_shortcode'); function display_custom_data_shortcode() { ob_start(); global $wpdb; $table_name = $wpdb->prefix . 'custom_data'; $search_results = []; $search_term = ''; // معالجة البحث if (isset($_GET['search_name']) && !empty($_GET['search_name'])) { $search_term = sanitize_text_field($_GET['search_name']); $search_results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name WHERE name LIKE %s", '%' . $wpdb->esc_like($search_term) . '%' ) ); } // الحصول على جميع البيانات $all_data = $wpdb->get_results("SELECT * FROM $table_name ORDER BY created_at DESC LIMIT 50"); ?>

البحث في البيانات

<input type="hidden" name="pagename" value=""> <input type="text" name="search_name" placeholder="اكتب اسم للبحث..." value=""> عرض الكل

نتائج البحث ( نتيجة)

name); ?>

البريد: email); ?>

الهاتف: phone); ?>

لا توجد نتائج للبحث

.custom-data-container { padding: 20px; background: #f9f9f9; border-radius: 5px; } .custom-search-form { margin: 20px 0; display: flex; gap: 10px; align-items: center; } .custom-search-form input[type="text"] { flex: 1; max-width: 300px; padding: 8px; } .results-table { margin-top: 20px; } .result-item { background: white; padding: 15px; margin-bottom: 10px; border-radius: 5px; border-left: 4px solid #0073aa; } <?php return ob_get_clean(); }
Scroll to Top