Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter rustyrust

    (@rustyrust)

    Hey,

    I’ve just copied the wp-editor-field.php to /my_theme/job_manager/ and made a small changes:

    <?php
    $editor = apply_filters( 'submit_job_form_wp_editor_args', array(
    	'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
    	'media_buttons' => false,
    	'textarea_rows' => 8,
    	'quicktags'     => false,
    	'tinymce'       => array(
    		'plugins'                       => '',
    		'paste_as_text'                 => true,
    		'paste_auto_cleanup_on_paste'   => true,
    		'paste_remove_spans'            => true,
    		'paste_remove_styles'           => true,
    		'paste_remove_styles_if_webkit' => true,
    		'paste_strip_class_attributes'  => true,
    		'theme_advanced_buttons1'       => 'bold, italic',
    		'theme_advanced_buttons2'       => '',
    		'theme_advanced_buttons3'       => '',
    		'theme_advanced_buttons4'       => ''
    	),
    ) );
    wp_editor( isset( $field['value'] ) ? esc_textarea( $field['value'] ) : '', $key, $editor );

    All the buttons are still shown.

    Thread Starter rustyrust

    (@rustyrust)

    Ok I’ve tried with the following code, problem is that the trailing slash isn’t working.

    add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data', 10, 5 );
    function custom_submit_job_form_save_job_data( $data, $post_title, $post_content, $status, $values ) {
    
      $job_slug   = array();
    
      // Prepend region
      if ( ! empty( $values['job']['job_region'] ) )
        $job_slug[] = $values['job']['job_region'];  
    
      // Prepend with company name
      if ( ! empty( $values['company']['company_name'] ) )
        $job_slug[] = $values['company']['company_name'];
    
      $job_slug[] = $post_title; 
    
      $data['post_name'] = implode( '/', $job_slug );
    
      return $data;
    }

    Result to: http://mywebsite.com/jobs/californiaapplevisual-designer

    Thread Starter rustyrust

    (@rustyrust)

    Indeed, it does! Thank you so much πŸ™‚

    Now I’m trying to add this field’s value to jobs permalinks using the filter function do you think that would be possible? Something like:

    http://mywebsite.com/jobs/california/apple/visual-designer

    Thread Starter rustyrust

    (@rustyrust)

    Job dashboard and resume dashboard.

    Thread Starter rustyrust

    (@rustyrust)

    Did that, I added new jobs but still output numbers. I give up.

    Thanks anyway.

    Thread Starter rustyrust

    (@rustyrust)

    I don’t think so because it also output a number…

    Thread Starter rustyrust

    (@rustyrust)

    Then what will the code be like for output ?

    Thread Starter rustyrust

    (@rustyrust)

    I removed the plugin and just working on your way now. Here’s my code

    add_filter( 'submit_job_form_fields', 'frontend_add_region_field' );
    
    function frontend_add_region_field( $fields ) {
      $fields['job']['job_region'] = array(
        'label' => 'Job Region',
        'type' => 'select',
        'required' => true,
        'options' => array ( 'Choose a region', 'California', 'Palto Alto', 'Another Example' ),
        'placeholder' => '',
        'priority' => 3
      );
      return $fields;
    }
    
    add_action( 'job_manager_update_job_data', 'frontend_add_region_field_save', 10, 2 );
    
    function frontend_add_region_field_save( $job_id, $values ) {
      update_post_meta( $job_id, '_job_region', $values['job']['job_region'] );
    }

    Now when I use

    <?php echo get_post_meta( $post->ID, '_job_region', true ); ?>

    It returns a number “2” corresponding to the second value of the select list “Palto Alto” in our example which it is true. Now how to convert this to a text value and show Palto Alto instead of the number ?

    Thread Starter rustyrust

    (@rustyrust)

    print_r(get_post_meta( $post->ID, ‘custom_field_slug’, true )); return nothing.

    Here’s a bit of code from the plugin:

    $field_id    = get_the_ID();
    $field_slug  = get_post_meta( $field_id, 'wpjmcf_field_slug', true );
    $field_type  = get_post_meta( $field_id, 'wpjmcf_field_type', true );
    $field_value = get_post_meta( $job_id, $field_slug, true );
    $options     = explode(",",get_post_meta( $field_id, 'wpjmcf_field_options', true ) );
    
    $out .= '<strong>'.get_the_title() . ':</strong> ';
    
    switch ( $field_type ) {
    case 'textarea':
    $out .= '<br />'.$field_value;
    break;
    case 'checkbox':
    if( 1 == $field_value ) {
    $out .= __( 'Yes', 'wpjmcf' );
    } else {
    $out .= __( 'No', 'wpjmcf' );
    }
    break;
    case 'file':
    $out .= '<a href="'.$field_value.'" target="_blank">'.__( 'Download', 'wpjmcf' ).'</a>';
    break;
    case 'select':
    $out .= $options[ $field_value ];
    break;
    
    default:
    $out .= get_post_meta( $job_id, $field_slug, true );
    break;
    }

    Does that give you an idea ? The “$options[ $field_value ];” doesn’t make sense for me.

    Thread Starter rustyrust

    (@rustyrust)

    Hey Mike,

    Thanks for the fast response. With Remi’s plugin, I couldn’t manage to output the value with get_post_meta when the custom field type is a select list. I tried this;

    <?php $myvalue = explode(",", get_post_meta( $post->ID, 'custom_field_slug', true ) ); print_r($myvalue); ?>

    I’m i doing something wrong ? The get_post_meta is working fine however with text fields.

    <?php echo get_post_meta( $post->ID, 'custom_field_slug', true ) ?>

    Got another question for you, I use a custom function that filter some custom fields to change their priorities and it’s working fine. Is it possible to move a custom field to the “Company details” section on job submission ?

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