WordPress.org

Forums

WP Job Manager
[resolved] What line do I change here for job type filters? (16 posts)

  1. cayonone
    Member
    Posted 9 months ago #

    Hi Mike,

    Please I'd like to uncheck the job type filters.

    What do I amend here?

    <?php wp_enqueue_script( 'wp-job-manager-ajax-filters' ); ?>
    <form class="job_filters">
    	<?php do_action( 'job_manager_job_filters_start', $atts ); ?>
    
    	<div class="search_jobs">
    		<?php do_action( 'job_manager_job_filters_search_jobs_start', $atts ); ?>
    
    		<div class="search_keywords">
    			<label for="search_keywords"><?php _e( 'Keywords', 'wp-job-manager' ); ?></label>
    			<input type="text" name="search_keywords" id="search_keywords" placeholder="<?php _e( 'All Jobs', 'wp-job-manager' ); ?>" value="<?php echo esc_attr( $keywords ); ?>" />
    		</div>
    
    		<div class="search_location">
    			<label for="search_location"><?php _e( 'Location', 'wp-job-manager' ); ?></label>
    			<input type="text" name="search_location" id="search_location" placeholder="<?php _e( 'Any Location', 'wp-job-manager' ); ?>" value="<?php echo esc_attr( $location ); ?>" />
    		</div>
    
    		<?php if ( $categories ) : ?>
    			<?php foreach ( $categories as $category ) : ?>
    				<input type="hidden" name="search_categories[]" value="<?php echo sanitize_title( $category ); ?>" />
    			<?php endforeach; ?>
    		<?php elseif ( $show_categories && ! is_tax( 'job_listing_category' ) && get_terms( 'job_listing_category' ) ) : ?>
    			<div class="search_categories">
    				<label for="search_categories"><?php _e( 'Category', 'wp-job-manager' ); ?></label>
    				<?php wp_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'All Job Categories', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category ) ); ?>
    			</div>
    		<?php endif; ?>
    
    		<?php do_action( 'job_manager_job_filters_search_jobs_end', $atts ); ?>
    	</div>
    
    	<?php do_action( 'job_manager_job_filters_end', $atts ); ?>
    </form>
    <noscript><?php _e( 'Your browser does not support JavaScript, or it is disabled. JavaScript must be enabled in order to view job listings.', 'wp-job-manager' ); ?></noscript>

    [moderated: please ensure that your code is enclosed in backticks (`) or use the code button.]

    Many thanks,

    Cay

    https://wordpress.org/plugins/wp-job-manager/

  2. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    Instead, look at the job-filter-job-types.php file. Remove the code:

    <?php checked( in_array( $type->slug, $selected_job_types ), true ); ?>

  3. cayonone
    Member
    Posted 9 months ago #

    Hi Mike,

    Many thanks for your response.
    Pls I tried it and it didn't work :(
    Kindly assist.

    Thanks.

  4. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    Paste your job-filter-job-types.php which you've modified (following my instructions above) here then, if you made the changes.

  5. cayonone
    Member
    Posted 9 months ago #

    <?php if ( ! is_tax( 'job_listing_type' ) && empty( $job_types ) ) : ?>
    	<ul class="job_types">
    		<?php foreach ( get_job_listing_types() as $type ) : ?>
    
    <li><label for="job_type_<?php echo $type->slug; ?>" class="<?php echo sanitize_title( $type->name ); ?>"><input type="checkbox" name="filter_job_type[]" value="<?php echo $type->slug; ?>" id="job_type_<?php echo $type->slug; ?>" /> <?php echo $type->name; ?></label></li>
    		<?php endforeach; ?>
    
    <?php elseif ( $job_types ) : ?>
    	<?php foreach ( $job_types as $job_type ) : ?>
    		<input type="hidden" name="filter_job_type[]" value="<?php echo sanitize_title( $job_type ); ?>" />
    	<?php endforeach; ?>
    <?php endif; ?>
  6. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    I think that looks ok. Where have you placed this file? What is it's path.

  7. cayonone
    Member
    Posted 9 months ago #

    Thanks, I placed it in mytheme/job_manager/job-filter-job-types.php

  8. Andrew
    Nuh uh moderator
    Posted 9 months ago #

    @cayonone, In future remember to wrap your code in backticks: http://snag.gy/hqlOQ.jpg

  9. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    hmm, could you add some text to that file, just to see if thats the one being used/loaded on the filter form?

  10. cayonone
    Member
    Posted 9 months ago #

    Hi Mike,

    Sorry for the silence.
    I still haven't been able to wrap my head around this.
    Any new development as to which file it is?

    Thanks and sorry for the trouble.

    Cay.

  11. FourLeafed
    Member
    Posted 9 months ago #

    @cayonone I have just tried the suggested code and I can confirm it is working (beside a missing end tag of the unordered list ) on my dev server.

    Try replacing the content of your-theme/job_manager/job-filter-job-types.php with the following:

    <?php if ( ! is_tax( 'job_listing_type' ) && empty( $job_types ) ) : ?>
        <ul class="job_types">
            <?php foreach ( get_job_listing_types() as $type ) : ?>
                <li><label for="job_type_<?php echo $type->slug; ?>" class="<?php echo sanitize_title( $type->name ); ?>"><input type="checkbox" name="filter_job_type[]" value="<?php echo $type->slug; ?>" id="job_type_<?php echo $type->slug; ?>" /> <?php echo $type->name; ?></label></li>
            <?php endforeach; ?>
        </ul>
    <?php elseif ( $job_types ) : ?>
        <?php foreach ( $job_types as $job_type ) : ?>
            <input type="hidden" name="filter_job_type[]" value="<?php echo sanitize_title( $job_type ); ?>" />
        <?php endforeach; ?>
    <?php endif; ?>
  12. cayonone
    Member
    Posted 9 months ago #

    Thanks for your help @FourLeafed.
    The one you sent didn't work either.
    Could my theme (jobify) be affecting it in any way?

  13. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    Yes if it has its own version of that template file. Have you tried the above code/template changes with another theme activated? (twenty twelve)

  14. cayonone
    Member
    Posted 9 months ago #

    Thanks Mike.
    No I haven't tried another theme - actually paranoid about doing that.
    Assuming it's the theme? Pls what do I do?
    Many thanks.

  15. Mike Jolley
    Member
    Plugin Author

    Posted 9 months ago #

    You'd only need to swap for a moment to test to see if it works. Then switch back.

  16. cayonone
    Member
    Posted 8 months ago #

    I see this has been taken care of in recent updates so no need to amend the files.
    Many thanks for an amazing plugin.

Reply

You must log in to post.

About this Plugin

  • WP Job Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.