WordPress.org

Support

Support » Plugins and Hacks » WP Job Manager » [Resolved] edit/remove fields in job form

[Resolved] edit/remove fields in job form

  • Hi,

    I don’t need all fields and I’d like to hide/remove some of them (ex: job_location)
    Is it possible to customize the form within the functions.php file or should I modify one of your file ?

    Thank you for your great plugin!

    David

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

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

    @mikejolley

    ok, I tried this but nothing happened

    function supprimer_champs_inutiles($fields) {
    	unset($fields['company']['company_name']);
    	unset($fields['company']['company_website']);
    	return $fields;
    	}
    	add_filter('submit_job_form_fields', 'supprimer_champs_inutiles');

    appreciate any advice, I’m a kind of newbie

    I think I wasn’t clear in my question.
    I was talking about the form in the admin panel (WP_Job_Manager_Writepanels)
    I don’t need to modify the front-end form because I won’t use it, only the admin (me) will be able to post a new job.

    So, my question is: How do I remove fields in the admin “Ad job” post form “job informations”?
    I don’t want to do it the hard way (removing some code in your files) because it would be a mess and tricky to maintain when making updates.

    ps: I’ve modified the front-end templates via mytheme/job_manager folder as requiered in your documentation. It would be great if I could do the something similar for the admin form.

    Plugin Author Mike Jolley

    @mikejolley

    Admin fields can be tweaked using the filter here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/admin/class-wp-job-manager-writepanels.php#L24

    Same kind of thing as the frontend forms.

    thank you so much, it works !

    If someone need to do it, here is an example:

    function delete_form_fields($fields) { // name your function whatever you want (here: delete_form_field)
    	unset($fields['_company_name']); // remove the field company name in the form
    	return $fields;
    	}
    	add_filter('job_manager_job_listing_data_fields', 'delete_form_fields');

    dti06, i also would like to remove some fields, both back- and front-end.
    i tried your code from your last post and added it to the functions.php.
    however, nothing got removed.
    could your explain it once more which steps are necessary to remove a certain field on both ends? your help would be much appreciated!!!
    kr martin

    Hi,
    I too am trying to do remove fields from both the back and front end as well. More detailed steps would be so very helpful.

    Thank you in advance for your time!

    I just follow explainations from Mikes on his Githubs page and hère in this post.
    If you want to remote fields in back,

    Just remove lines or tag them as comment. For example I don’t wan’t company fields (back and front)

    In the fonction.php I did:

    function delete_form_fields($fields) {
    	unset($fields['_company_name']);
    	unset($fields['_company_website']);
    	unset($fields['_company_tagline']);
    	unset($fields['_company_twitter']);
    	unset($fields['_company_logo']);
    	return $fields;
    	}
    	add_filter('job_manager_job_listing_data_fields', 'delete_form_fields');

    Then in my template content-single-job_listing.php (inside the job_manager folder in my theme), I just put corresponding lines in comment tag

    <!--
    		<div class="company" itemscope itemtype="http://data-vocabulary.org/Organization">
    			<?php the_company_logo(); ?>
    
    			<p class="name">
    				<a class="website" href="<?php echo get_the_company_website(); ?>" itemprop="url"><?php _e( 'Website', 'job_manager' ); ?></a>
    				<?php the_company_twitter(); ?>
    				<?php the_company_name( '<strong itemprop="name">', '</strong>' ); ?>
    			</p>
    			<?php the_company_tagline( '<p class="tagline">', '</p>' ); ?>
    		</div>
    -->

    Hope you can find out how to customize your fields now.

    This is great and works fine except for _featured.

    I added `function delete_form_fields($fields) {
    unset($fields[‘_company_name’]);
    unset($fields[‘_company_website’]);
    unset($fields[‘_application’]);
    unset($fields[‘_company_tagline’]);
    unset($fields[‘_company_twitter’]);
    unset($fields[‘_company_logo’]);
    unset($fields[‘_filled’]);
    unset($fields[‘_featured’]);
    return $fields;
    }
    add_filter(‘job_manager_job_listing_data_fields’, ‘delete_form_fields’);`

    which removes the fields from admin, but the submitted jobs then don’t show up in the [jobs] page.
    If I remove _featured filter then it works fine.
    Any ideas? Or shall I just resort to removing it directly from the …writepanels.php file?

    Plugin Author Mike Jolley

    @mikejolley

    You can unset featured, but you will need to hook in elsewhere and ensure the meta data _featured is set (to 0). WordPress does not let you do a query for postmeta when the value doesn’t exist in the DB.

    I’ve logged an issue for that https://github.com/mikejolley/WP-Job-Manager/issues/159

    commenting the fields did not work for me. any other suggestions?

    you did something wrong because it works fine.

    You can get a free beta license for my field editor plugin that will allow you to disable some of the default fields from the frontend:

    https://plugins.smyl.es/wp-job-manager-field-editor/

    Feature will soon be added to hide only on frontend or admin section but right now it will disable the field both admin and frontend.

    I used the code above and was able to remove the fields from the admin page, but how can I remove the company info fields from the submit jobs page?

    Use the plugin I mentioned above 😛

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] edit/remove fields in job form’ is closed to new replies.
Skip to toolbar