• Resolved Dhanashree P

    (@dhanashreep123)


    I have added extra two options for filtering using custom fields. But not getting proper result if I select any one from custom options. So where should I add/edit code for search result?Please help me.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Dhanashree P

    (@dhanashreep123)

    Added custom filed code in job-filter.php after do_action( ‘simple_job_board_job_filters_dropdowns_end’, $atts ); (line no. 114)

    Plugin Author PressTigers

    (@presstigers)

    Hi

    After adding filter options, you need to add all these parameters in result query too (which is responsible to get search results).

    Here is the file path,
    simple-job-board/includes/shortcodes/class-simple-job-board-shortcode-jobpost.php
    Kindly go to the above mentioned file and understand code structure & logic to customise it.

    Thanks & Regards,
    PressTigers

    Thread Starter Dhanashree P

    (@dhanashreep123)

    Hi,

    I tried your solution but not getting success. Please can you check my below code and help me : (on line no 116)

    Below code added in job-filters.php to display option in filter on fron-end :
    /*
    * Get a field object and display it with it’s value
    */

    $field_name = “skills”;
    $field = get_field_object($field_name);

    echo $field[‘value’];

    /*
    * Get a field object and display it with it’s value (using the field key and the value fron another post)
    */

    $field_key = “field_57f61b1cc9ea9”;
    $post_id = $post_id;
    $field = get_field_object($field_key, $post_id);

    echo $field[‘value’];

    /*
    * Get a field object and create a select form element
    */

    $field_key = “field_57f61b1cc9ea9″;
    $field = get_field_object($field_key);

    if( $field )
    {
    echo ‘<div id=”sjb-form-padding” class=”sjb-search-location sjb-col-md-3″><select name=”‘ . $field[‘key’] . ‘” id=”skills”>’;
    echo ‘<option value=”-1″>Skillsets</option>’;
    foreach( $field[‘choices’] as $k => $v )
    {
    echo ‘<option value=”‘ . $k . ‘”>’ . $v . ‘</option>’;
    }
    echo ‘</select></div>’;
    }

    And below code added in simple-job-board/includes/shortcodes/class-simple-job-board-shortcode-jobpost.php (on line no 53)

    ‘skills’ => ”,
    ‘exp’ => ”,

    then in same file on line no 87 :

    $args[‘skillset’] = (isset($_GET[‘field_57f61b1cc9ea9’]) && -1 != $_GET[‘field_57f61b1cc9ea9’]) ? esc_attr($_GET[‘field_57f61b1cc9ea9’]) : esc_attr($shortcode_args[‘skills’]);
    $args[‘experience’] = (isset($_GET[‘field_57f61ba4c9eaa’]) && -1 != $_GET[‘field_57f61ba4c9eaa’]) ? esc_attr($_GET[‘field_57f61ba4c9eaa’]) : esc_attr($shortcode_args[‘exp’]);

    Please can you help me for this?

    Thread Starter Dhanashree P

    (@dhanashreep123)

    Please anyone help me? It’s urgent…

    Plugin Author PressTigers

    (@presstigers)

    Hi @dhanashreep123,

    We can’t verify your code as you are writing custom code. We have already given direction to you in our previous reply.

    If you want to customize your code then we strongly suggest you please take help from an expert programmer.

    Thanks & Regards,
    PressTigers

    Thread Starter Dhanashree P

    (@dhanashreep123)

    Hi,

    Thank you so much your reply, we tried a lot but not getting any success.

    But I just want to know, search functionality is working on short codes and for custom fields I’m not creating any short code. So, how to use this?

    In your suggested file I have added below code for skill set but it’s not working, so can you help me for this? Or any other way for extra search fields?

    get_simple_job_board_template(‘listing/job-listings-start.php’);

    if ( ‘false’ != strtolower( $shortcode_args[‘search’] ) && !empty( $shortcode_args[‘search’] ) ):

    /**
    * Template -> Job Filters:
    *
    * – Keywords Search.
    * – Job Category Filter.
    * – Job Type Filter.
    * – Job Location Filter.
    * – Skillset Filter.
    * – Experience Filter.
    *
    * Search jobs by keywords, category, location, skilset, experience & type.
    */
    get_simple_job_board_template( ‘job-filters.php’, array(‘per_page’ => $shortcode_args[‘posts’],
    ‘order’ => $shortcode_args[‘order’],
    ‘categories’ => $shortcode_args[‘category’],
    ‘job_types’ => $shortcode_args[‘type’],
    ‘atts’ => $atts,
    ‘location’ => $shortcode_args[‘location’],
    ‘skillset’ => ‘css’,
    ‘keywords’ => $shortcode_args[‘keywords’] ) );
    endif;

    Please reply asap.

    Thank you.

    Plugin Author PressTigers

    (@presstigers)

    /**
    * Template -> Job Filters:
    *
    * – Keywords Search.
    * – Job Category Filter.
    * – Job Type Filter.
    * – Job Location Filter.
    * – Skillset Filter.
    * – Experience Filter.
    *
    * Search jobs by keywords, category, location, skilset, experience & type.
    */

    If you are making custom filters for Skillset & Experience then it’s not a right way to add custom filters.

    First, try to understand the SJB code structure and then customize its code. For a glimpse, we can tell you that please go through from the following files and then customize your code.
    simple-job-board/templates/job-filters.php
    simple-job-board/templates/search/category-filter.php
    simple-job-board/templates/search/keyword-search.php
    simple-job-board/includes/shortcodes/class-simple-job-board-shortcode-jobpost.php

    Also, SJB plugin is having action hooks. Please use these hooks according to your requirements. So that your changes are not overwritten on plugin update.

    If you don’t know the usage of WP hooks then we strongly suggest you please take help from a WP expert programmer.

    Thank you for using SJB! Let us know if you need our further assistance.

    Thanks & Regards,
    PressTigers

    Thread Starter Dhanashree P

    (@dhanashreep123)

    Ok thanks for suggestion.

    I have created new taxonomy for skill set and experience. And it’s working fine now.

    Just want to know how to add plugins files in child theme. I know for “template folder”. But for other folders I need to do changes in main plugin files.

    Plugin Author PressTigers

    (@presstigers)

    For templating, see other notes section.

    But for other folders I need to do changes in main plugin files.

    As we told you in the previous reply:

    Also, SJB plugin is having action hooks. Please use these hooks according to your requirements. So that your changes are not overwritten on plugin update.

    Thanks & Regards,
    PressTigers

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Custom Search filter’ is closed to new replies.