WordPress.org

Support

Support » Plugins and Hacks » WP Job Manager » [Resolved] What line do I change here for job type filters?

[Resolved] What line do I change here for job type filters?

  • 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/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Mike Jolley

    @mikejolley

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

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

    Hi Mike,

    Many thanks for your response.
    Pls I tried it and it didn’t work 🙁
    Kindly assist.

    Thanks.

    Plugin Author Mike Jolley

    @mikejolley

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

    <?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; ?>
    Plugin Author Mike Jolley

    @mikejolley

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

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

    Moderator Andrew Nevins

    @anevins

    Forum moderator

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

    Plugin Author Mike Jolley

    @mikejolley

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

    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.

    @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; ?>

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

    Plugin Author Mike Jolley

    @mikejolley

    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)

    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.

    Plugin Author Mike Jolley

    @mikejolley

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

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

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Resolved] What line do I change here for job type filters?’ is closed to new replies.
Skip to toolbar