Created
May 6, 2016 15:55
-
-
Save hemusyl/a2780723df4ad6b95e094fac974a4238 to your computer and use it in GitHub Desktop.
wp advances search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function advance_newpage_search() { | |
$args = array(); | |
$args['wp_query'] = array( 'post_type' => array('job'), | |
'orderby' => 'title', | |
'order' => 'ASC' ); | |
// Here is where we specify the page where results will be shown | |
$args['form'] = array( 'action' => get_bloginfo('url') . '/newpage' ); // create a page what slug name is "newpage". | |
$args['fields'][] = array( 'type' => 'search', | |
'class' => array('form-group','form-control'), | |
'placeholder' => 'Enter search terms' ); | |
$args['fields'][] = array( 'type' => 'meta_key',// Because it is meta box | |
'class' => array('form-group','form-control'), | |
'format' => 'select', | |
'meta_key'=>'job_type', // job_type is the meta key id | |
'values' => array( | |
'Fulltime' => 'Full Time',// FullTime is the value of meta boxes and so on... | |
'PartTime'=>'Part Time',// PartTime is the value of meta boxes. | |
'Contractual'=>'Contractual', | |
) ); | |
$args['fields'][] = array( 'type' => 'taxonomy',// taxonomy outomitac asbe | |
'class' => array('form-group','form-control'), | |
'format' => 'select', | |
'taxonomy'=>'job_locationa',// "job_locationa" is the taxonomy name. | |
); | |
$args['fields'][] = array( 'type' => 'submit', | |
'class' => 'btn', | |
'value' => 'Search' ); | |
register_wpas_form('newpage', $args); | |
} | |
add_action('init','advance_newpage_search'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment