• Resolved rohitkalra

    (@rohitkalra)


    I am trying to add custom field in wp job manager but it’s not showing in search results as I have also asked this question in stack exchange so I am sharing the link
    link -https://wordpress.stackexchange.com/questions/341816/adding-custom-field-in-wp-job-manager-but-unable-to-show-on-search-page-on-jobs
    As you can see I have used three codes
    -one for job submission
    -one for displaying in single job listing
    -one for showing in search result
    it’s not filtering and I think the mistake is in the third code

    • This topic was modified 4 years, 10 months ago by rohitkalra.
Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    Thread Starter rohitkalra

    (@rohitkalra)

    @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

    Plugin Contributor Richard Archambault

    (@richardmtl)

    @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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding custom field but not showing in search results’ is closed to new replies.