Member Search 會員搜尋

[acf field="last-name"]
[acf field="first-name"]
[acf field="membership-number"]
[acf field="search-button"]

<form method="get" action="<?php echo home_url( '/' ); ?>">
  <label for="last-name">Last Name:</label>
  <input type="text" name="last-name" id="last-name" value="<?php echo get_search_query(); ?>">
  <label for="first-name">First Name:</label>
  <input type="text" name="first-name" id="first-name" value="<?php echo get_search_query(); ?>">
  <label for="membership-number">Membership Number:</label>
  <input type="text" name="membership-number" id="membership-number" value="<?php echo get_search_query(); ?>">
  <input type="submit" value="Search">
</form>

<?php
// Get the search criteria from the URL query string
$last_name = isset( $_GET['last-name'] ) ? sanitize_text_field( $_GET['last-name'] ) : '';
$first_name = isset( $_GET['first-name'] ) ? sanitize_text_field( $_GET['first-name'] ) : '';
$membership_number = isset( $_GET['membership-number'] ) ? sanitize_text_field( $_GET['membership-number'] ) : '';

// Set up the query arguments
$args = array(
  'post_type' => 'member', // Change this to the custom post type that you are using to store your members
  'meta_query' => array(
    'relation' => 'AND',
    array(
      'key' => 'last_name', // Change this to the field key for the last name field
      'value' => $last_name,
      'compare' => 'LIKE',
    ),
    array(
      'key' => 'first_name', // Change this to the field key for the first name field
      'value' => $first_name,
      'compare' => 'LIKE',
    ),
    array(
      'key' => 'membership_number', // Change this to the field key for the membership number field
      'value' => $membership_number,
      'compare' => 'LI


Under Construction !