function job_search_func( $atts ) {
$html = "";
$html .='<div class="job_listings">';
$html .='<form class="job_filters" action="/jobs/" method="GET">
<div class="search_jobs">
<div class="search_keywords">
<label for="search_keywords">Keywords</label>
<input type="text" name="search_keywords" id="search_keywords" placeholder="Keywords" value="">
</div>
<div class="search_location">
<label for="search_location">Location</label>
<input type="text" name="search_location" id="search_location" placeholder="Location" value="">
</div>';
$html .= '<div class="search_categories">
<label for="search_categories">Category</label>';
$html .= job_search_job_manager_dropdown_categories( apply_filters( 'job_manager_regions_dropdown_args', array(
'show_option_all' => __( 'All Category', 'wp-job-manager-locations' ),
'hierarchical' => true,
'orderby' => 'name',
'taxonomy' => 'job_listing_category',
'name' => 'search_category',
'class' => 'job-manager-category-dropdown',
'id' => 'search_categories',
'hide_empty' => 1,
'multiple' => false,
//'selected' => isset( $atts[ 'selected_region' ] ) ? $atts[ 'selected_region' ] : ''
) ) );
$html .= '</div>';
$html .='<div class="search_location search_submit">
<input type="submit" value="Search" />
</div>
</div>
</form>
</div>';
return $html;
}
add_shortcode( 'job_search_box', 'job_search_func' );
/**
* Based on wp_dropdown_categories, with the exception of supporting multiple selected categories.
* @see wp_dropdown_categories
*/
function job_search_job_manager_dropdown_categories( $args = '' ) {
$defaults = array(
'orderby' => 'id',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 1,
'child_of' => 0,
'exclude' => '',
'echo' => 1,
'selected' => 0,
'hierarchical' => 0,
'name' => 'cat',
'id' => '',
'class' => 'job-manager-category-dropdown ' . ( is_rtl() ? 'chosen-rtl' : '' ),
'depth' => 0,
'taxonomy' => 'job_listing_category',
'value' => 'id',
'multiple' => true,
'show_option_all' => false,
'placeholder' => __( 'Choose a category…', 'wp-job-manager' ),
'no_results_text' => __( 'No results match', 'wp-job-manager' ),
'multiple_text' => __( 'Select Some Options', 'wp-job-manager' )
);
$r = wp_parse_args( $args, $defaults );
if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
$r['pad_counts'] = true;
}
extract( $r );
// Store in a transient to help sites with many cats
$categories_hash = 'jm_cats_' . md5( json_encode( $r ) . WP_Job_Manager_Cache_Helper::get_transient_version( 'jm_get_' . $r['taxonomy'] ) );
$categories = get_transient( $categories_hash );
if ( empty( $categories ) ) {
$categories = get_terms( $taxonomy, array(
'orderby' => $r['orderby'],
'order' => $r['order'],
'hide_empty' => $r['hide_empty'],
'child_of' => $r['child_of'],
'exclude' => $r['exclude'],
'hierarchical' => $r['hierarchical']
) );
set_transient( $categories_hash, $categories, DAY_IN_SECONDS * 30 );
}
$name = esc_attr( $name );
$class = esc_attr( $class );
$id = $id ? esc_attr( $id ) : $name;
$output = "<select name='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "' " . ( $multiple ? "multiple='multiple'" : '' ) . " data-placeholder='" . esc_attr( $placeholder ) . "' data-no_results_text='" . esc_attr( $no_results_text ) . "' data-multiple_text='" . esc_attr( $multiple_text ) . "'>\n";
if ( $show_option_all ) {
$output .= '<option value="">' . esc_html( $show_option_all ) . '</option>';
}
if ( ! empty( $categories ) ) {
include_once( JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-category-walker.php' );
$walker = new WP_Job_Manager_Category_Walker;
if ( $hierarchical ) {
$depth = $r['depth']; // Walk the full depth.
} else {
$depth = -1; // Flat.
}
$output .= $walker->walk( $categories, $depth, $r );
}
$output .= "</select>\n";
//if ( $echo ) {
//echo $output;
//}
return $output;
}
Please paste this shortcode anywhere
job_search_box
It can help you