Hello,
I have the same concern,
I added the code which is on following link
“https://wpjobmanager.com/document/tutorial-creating-custom-job-search-form/”
And then the piece of code also provided on the site
function my_wpjm_meta_key_dm() {
global $wpdb, $job_manager_keyword;
$searchable_meta_keys[] = ‘_my_meta_field’;
return $searchable_meta_keys;
}
add_filter(‘job_listing_searchable_meta_keys’, ‘my_wpjm_meta_key_dm’);
But it does not work, I would like to know the solution
cordially
@nghtmre
I don’t know coding
you know coding ? .If yes ,can you please check my codes using the above link
I added using snippets, in my case the issue is that I am unable to filter the custom field
as you can see I added a custom field additional information
freshers can also apply
and
final year students can also apply
but in search results it shows results only for freshers can also apply may be there is issue in my code .Here is the link-https://wordpress.stackexchange.com/questions/341816/adding-custom-field-in-wp-job-manager-but-unable-to-show-on-search-page-on-jobs
and also mentioned the
code which i used to show in search on [jobs] page
add_action( ‘job_manager_job_filters_search_jobs_end’, ‘filter_by_Additional_information_field’ );
function filter_by_Additional_information_field() {
?>
<div class=”search_categories”>
<label for=”search_categories”><?php _e( ‘Additional_information’, ‘wp-job-manager’ ); ?></label>
<select name=”filter_by_Additional_information” class=”job-manager-filter”>
<option value=””><?php _e( ‘Default’, ‘wp-job-manager’ ); ?></option>
<option value=”Final year students can also apply”><?php _e( ‘Final year students can also apply’, ‘wp-job-manager’ ); ?></option>
<option value=”Freshers can also apply”><?php _e( ‘Freshers can also apply’, ‘wp-job-manager’ ); ?></option>
</select>
</div>
<?php
}
add_filter( ‘job_manager_get_listings’, ‘filter_by_Additional_information_field_query_args’,10, 2 );
function filter_by_Additional_information_field_query_args( $query_args, $args ) {
if ( isset( $_POST[‘form_data’] ) ) {
parse_str( $_POST[‘form_data’], $form_data );
if ( ! empty( $form_data[‘filter_by_Additional_information’] ) ) {
$selected_range = sanitize_text_field( $form_data[‘filter_by_Additional_information’] );
switch ( $selected_range ) {
case ‘Final year students can also apply’ :
$query_args[‘meta_query’][] = array(
‘key’ => ‘_job_Additional_information’,
‘value’ => ‘Final year students can also apply’,
‘type’ => ‘TEXT’
);
case ‘Freshers can also apply’ :
$query_args[‘meta_query’][] = array(
‘key’ => ‘_job_Additional_information’,
‘value’ => ‘Freshers can also apply’,
‘type’ => ‘TEXT’
);
}
add_filter( ‘job_manager_get_listings_custom_filter’, ‘__return_true’ );
}
}
return $query_args;
}
And in your case the issue is different. Have you tried with custom template
@nghtmre Could you please start your own thread, as per the Forum Welcome?
https://make.wordpress.org/support/handbook/forum-welcome/#post-in-the-best-place
You can post your own thread here:
https://wordpress.org/support/plugin/wp-job-manager#postform
Thank you!
@rohitkalra Please don’t post multiple topics for the same thing. As I mentioned in your other thread, we can’t troubleshoot your code, sorry. I also suggest you use this plugin instead:
https://plugins.smyl.es/wp-job-manager-field-editor/
I will close this thread since it’s a duplicate of your other one.