Advertisement
Guest User

Untitled

a guest
May 6th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. function advance_newpage_search() {
  2. $args = array();
  3. $args['wp_query'] = array( 'post_type' => array('job'),
  4. 'orderby' => 'title',
  5. 'order' => 'ASC' );
  6.  
  7. // Here is where we specify the page where results will be shown
  8. $args['form'] = array( 'action' => get_bloginfo('url') . '/newpage' ); // create a page what slug name is "newpage".
  9.  
  10. $args['fields'][] = array( 'type' => 'search',
  11. 'class' => array('form-group','form-control'),
  12. 'placeholder' => 'Enter search terms' );
  13.  
  14. $args['fields'][] = array( 'type' => 'meta_key',// Because it is meta box
  15. 'class' => array('form-group','form-control'),
  16. 'format' => 'select',
  17. 'meta_key'=>'job_type', // job_type is the meta key id
  18. 'values' => array(
  19. 'Fulltime' => 'Full Time',// FullTime is the value of meta boxes and so on...
  20. 'PartTime'=>'Part Time',// PartTime is the value of meta boxes.
  21. 'Contractual'=>'Contractual',
  22. ) );
  23.  
  24. $args['fields'][] = array( 'type' => 'taxonomy',// taxonomy outomitac asbe
  25. 'class' => array('form-group','form-control'),
  26. 'format' => 'select',
  27. 'taxonomy'=>'job_locationa',// "job_locationa" is the taxonomy name.
  28. );
  29.  
  30. $args['fields'][] = array( 'type' => 'submit',
  31. 'class' => 'btn',
  32. 'value' => 'Search' );
  33. register_wpas_form('newpage', $args);
  34. }
  35. add_action('init','advance_newpage_search');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement