I would like to add video to my WP Job Manager form

I want to create a custom field and then add video plugin's shortcode. How would I write it? I have this code. I am also using the jobinn-child theme.

// Add your own function to filter the fields
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );

// This is your function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields( $fields ) {

// Here we target one of the job fields (candidate name) and change it's label
$fields['resume_fields']['candidate_name']['label'] = "The Candidate Name";

// And return the modified fields
return $fields;
}

  • Lindeni Mahlalela

    Hello Wiztech,

    I hope you are doing great today and thank you for contacting us.

    By the looks of it your theme is using the plugin WP Job Manager, it relies on it to provide its core functionality. The example you have included in your question is about modifying existing fields before they are printed on the form. If I understand your question very well, you want to add new fields to the form not modifying existing ones, according to the WP Job Manager Documentation this is the function you are looking for:

    // Add field to frontend
    add_filter( 'submit_resume_form_fields', 'wpjms_frontend_resume_form_fields' );
    function wpjms_frontend_resume_form_fields( $fields ) {
    	$fields['resume_fields']['candidate_color'] = array(
    	    'label' => __( 'Favourite Color', 'job_manager' ),
    	    'type' => 'text',
    	    'required' => true,
    	    'placeholder' => '',
    	    'priority' => 1
    	);
    	return $fields;
    }

    The code above should add a new field called 'candidate_color' and will be labeled "Candidate Color', you can use the same function to add more fields to the front end form. Say for example you want to add a Nickname field, then you should add the following line before the

    return $fields;

    Line, add the following:

    $fields['resume_fields']['candidate_nickname'] = array(
    	    'label' => __( 'Nickname', 'job_manager' ),
    	    'type' => 'text',
    	    'required' => true,
    	    'placeholder' => '',
    	    'priority' => 1
    );

    That should add the new Nickname field to your form. That is how you can add custom fields to the front end forms. To add fields to the admin side, please refer to the "Add field to admin" example on this page. That covers how to add fields in general.

    I want to create a custom field and then add video plugin's shortcode.

    I am not sure if I understand this part but you should be able to add any custom field as described above, the only difference will be when you want to add a custom predefined value or when you want to display a static field like an embedded video or some other static content, in which case you should try the 'value' attribute in the form field properties, assign a value to this field, in your case you can try:

    $fields['resume_fields']['candidate_nickname'] = array(
    	    'label' => __( 'Nickname', 'job_manager' ),
    	    'type' => 'text',
    	    'required' => true,
    	    'placeholder' => '',
    	    'priority' => 1,
                'value' => '[video_shortcode]' //use the proper shortcode
    );

    I hope that helps, please let me know if I have missed something.

    Cheers,
    Mahlamusa

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.