• Resolved Nicholas Griffin

    (@thetechnuttyuk)


    Hey,

    I was wondering if it was possible to add fields from Advanced Custom Fields to the post submission page?

    I have used the function to add the salary field and I’ve tried doing it with a similar piece of code, however, this doesn’t seem to be doing what I want, I was thinking that it might just link to a meta value but it doesn’t seem to be.

    function frontend_add_postingtype_field( $fields ) {
        $fields['job']['_postinngtype'] = array(
          'label'       => __( 'Posting Type', 'job_manager' ),
          'type'        => 'text',
          'required'    => true,
          'placeholder' => 'e.g. Careers',
          'priority'    => 7
        );
        return $fields;
      }
      add_filter( 'submit_job_form_fields', 'frontend_add_postingtype_field' );

    It did add the field, however, it doesn’t seem to be doing anything inn the backend.

    Is there any way that I can currently do this or is it something that can be added?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jen H. (a11n)

    (@jenhooks)

    Hi @thetechnuttyuk,

    I can’t speak to Advanced Custom Fields specifically, but have you also looked at the “Add the field to admin” section in our documentation here?

    https://wpjobmanager.com/document/tutorial-adding-a-salary-field-for-jobs/

    You might be able to tweak that code to achieve what you’re looking for, but assistance with implementing customizations is outside of the scope of the support that we offer, per our Support Policy:

    https://wpjobmanager.com/support-policy/.

    If you need it, you can search for development help in a variety of places — here are a few to start:

    https://jobs.wordpress.net/
    https://jetpack.pro/
    https://codeable.io/?ref=l1TwZ

    I’ll leave this open for a few days in case there’s someone else in the community who would like to chime in and lend a hand.

    Best of luck.

    Thread Starter Nicholas Griffin

    (@thetechnuttyuk)

    Thanks, it took me a while, but I have figured out a way of doing this, might make for a good post somewhere as I reckon some might like to do this.

    Basically, I just added a function to the preview page that updates the advanced custom field, currently, mine gets a value from another field on the post a job page and pushes that to ACF, this allows me to conjoin the two ways that I am posting jobs.

    Here’s the function:

    <?php
    $post_id = $form->get_job_id();
    $values = get_post_meta( get_the_ID());
    foreach($values as $key=>$val){
      foreach($val as $vals){
    	   if ($key == '_postingtype_paj') {
    		update_post_meta($post_id, 'postingtype', $vals );
    		echo the_field('postingtype');
    	   }
       }
     }
    
    ?>
    Plugin Contributor Jen H. (a11n)

    (@jenhooks)

    Hey @thetechnuttyuk,

    Thanks so much for the followup. Someone may find that super useful in the future. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add fields to the post submission page from ACF’ is closed to new replies.