Function Reference: geodir_search_form_post_type_input

Summary

This function has not been documented yet.

Filters

‘geodir_search_form_post_types’ [Line: 2323]

Source File

geodir_search_form_post_type_input() is located in geodirectory-functions/custom_functions.php [Line: 2321]

Source Code

function geodir_search_form_post_type_input() {
	global $geodir_search_post_type;
	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
	$curr_post_type = $geodir_search_post_type;

	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {

		foreach ( $post_types as $post_type => $info ){
			global $wpdb;
			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
			if ( ! $has_posts ) {
				unset($post_types->{$post_type});
			}
		}

		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {

			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
			if ( $new_style ) {
				echo "
"; } ?> "; } }else{ if(! empty( $post_types )){ $pt_arr = (array)$post_types; echo ''; }else{ echo ''; } } }elseif ( ! empty( $post_types ) ) { echo ''; } }