Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter max.eclairs

    (@maxeclairs)

    i have put new input form field in search-author.php. This field will get the zip code from user. I have created a function in functions.php

    //function for searching by zip used in simple user listing plugin
    function get_users_by_meta_data_zip( $meta_value ) {
    
    	// Query for users based on the meta data
    	$user_query = new WP_User_Query(
    		array(
    			'meta_key'	  =>	'_zip',
    			'meta_value'	=>	$meta_value
    		)
    	);
    
    	$users_by_zip = $user_query->get_results();
    
    	return $users_by_zip;
    
    } // end get_users_by_meta_data

    this function returns $users_by_zip which i use in simple-user-listing.php to generate list on the basis of zip code. Everything is working fine. The code is now fetching the users having that zip code in their meta field. But the problem is, whenever i search by putting in some zip code, it shows the result without displaying footer and sidebar of my theme. Can please help me out on this?
    Thanks,

    Thread Starter max.eclairs

    (@maxeclairs)

    Ok i checked the FAQ. The only thing i wanted to ask after reading this is, how can i add both search fields “search by name” and “search by billing city” or whatever, so that there will be two search fields with two submit buttons. I hope you are getting what I am trying to say.

    Thread Starter max.eclairs

    (@maxeclairs)

    Got it resolved. Thanks anyways. My next issue is if i want to perform a search based on other user meta data instead of user name, like zip code, city, country, etc. how it should be done?

Viewing 3 replies - 1 through 3 (of 3 total)