Support

Account

Forum Replies Created

  • Thanks for your help @james!

    By adding the field_group it worked perfectly!
    Since I thought this was weird, I’ve double checked the post type that I gave the local group. Apparently I made a typo in there, which is why it didn’t show in the beginning.

    Thanks a lot for your help!

    Tim

  • Hi @james,

    Although that could have been the problem, the post type is correct since I do get an ACF Form. The problem is that the local fields are missing. Is there something that should be added to the options to combine the local and the database fields in an acf_form?

    Thanks

    Tim

  • I’ve already checked the source code, but I’ve not been able to find this.
    So for now I made the step to the given link above, but I can’t seem to get this to work with acf_form(). Is there something I need to add to the options?
    I pasted the following in functions.php:

    acf_add_local_field_group(array (
    			'key' => 'group_1',
    			'title' => 'My Group',
    			'fields' => array (
    				array (
    					'key' => 'field_1',
    					'label' => 'Sub Title',
    					'name' => 'sub_title',
    					'type' => 'text',
    					'prefix' => '',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'default_value' => '',
    					'placeholder' => '',
    					'prepend' => '',
    					'append' => '',
    					'maxlength' => '',
    					'readonly' => 0,
    					'disabled' => 0,
    				)
    			),
    			'location' => array (
    				array (
    					array (
    						'param' => 'post_type',
    						'operator' => '==',
    						'value' => 'book',
    					),
    				),
    			),
    			'menu_order' => 0,
    			'position' => 'normal',
    			'style' => 'default',
    			'label_placement' => 'top',
    			'instruction_placement' => 'label',
    			'hide_on_screen' => '',
    		));

    book is a post type that I created.
    And this is what I use to create the form:

    $options = array(
    
        	/* (int|string) The post ID to load data from and save data to. Defaults to the current post ID.
        	Can also be set to 'new_post' to create a new post on submit */
        	'post_id' => 'new_post',
        	'form_attributes' => array( // attributes will be added to the form element
            'class' => ''
          ),
    
        	/* (array) An array of post data used to create a post. See wp_insert_post for available parameters.
        	The above 'post_id' setting must contain a value of 'new_post' */
        	'new_post' =>  array(
        						'post_type'		=> $_POST['type'],
        						'post_status'		=> $post_status
        					),
    
        	/* (boolean) Whether or not to show the post title text field. Defaults to false */
        	'post_title' => true,
    
        	/* (boolean) Whether or not to show the post content editor field. Defaults to false */
        	'post_content' => true,
    
        	/* (boolean) Whether or not to create a form element. Useful when a adding to an existing form. Defaults to true */
          	'form' => false
          );
        acf_form($options);

    Thanks for your help so far!

    Tim

  • Hi @james,

    With “post fields with PHP” I mean that when you import a json file, it puts those files in a database right? If that is possible, shouldn’t it also be possible to add new fields programmatically? If they are not in a database, where are they stored?

    Thanks a lot!
    Tim

  • Hi @james,

    Isn’t it weird that it is not possible to post fields with php? Since this is exactly what happens when you load a json file with the import tool. I can’t seem to figure out how this works though..
    Any idea if this is usable?

    Sincerely,
    Tim

  • Hi @James

    Thanks for your help so far, but I don’t think this solves my question.
    I’d like to add fields to an already existing flexible content field.
    Is this also possible with synchronized json? If so, how can I implement it?

    Thanks for your help so far!

    Tim

  • I’m stuck on the same problem.
    I responded to a previously post, (http://support.advancedcustomfields.com/forums/topic/front-end-form-and-register_field_group/#post-32096) which I hope @elliot will have a solution for.
    Did you find a solution yet?

    Tim

  • Somehow the array for the field_groups doesn’t work with the keys of the field for me.
    I’m using it as followed:

    
    'field_groups' => array('field_5630c8fa19205', 'field_564332d068410')
    

    Am I doing this the right way or should it be done different?
    I know it’s possible to use the post ID as well, but I need to use the keys for this one.

    Thanks in advance!

    Tim

  • Never mind, I already found the solution! just check the attribute “checked”. If the box is checked it will return the value “checked”. Otherwise the attribute will be undefined.
    So by using this code I check all the boxes within a certain div:

    if (jQuery(this).attr("checked")) {
          // in here it means that the checkbox is checked
    }
  • I think I’ve got the same problem as ngtrian.
    Somehow I’m not able to embed a video in a front-end form.
    In the back-end it works fine, but in the front-end it shows the link.
    Ive also tried it by clicking the “Add Media” button, but in this case it shows the link within the [embed] [/embed] tags.
    Is there something that I’m missing with creating the acf-form?
    I’m using the following code:

    $options = array(
    
        	/* (int|string) The post ID to load data from and save data to. Defaults to the current post ID.
        	Can also be set to 'new_post' to create a new post on submit */
        	'post_id' => 'new_post',
        	'form_attributes' => array( // attributes will be added to the form element
            'class' => ''
          ),
        
        	/* (array) An array of post data used to create a post. See wp_insert_post for available parameters.
        	The above 'post_id' setting must contain a value of 'new_post' */
        	'new_post' =>  array(
        						'post_type'		=> 'odin_page', // This is my own created post type.
        						'post_status'		=> 'publish'
        					),
        
        	/* (boolean) Whether or not to show the post title text field. Defaults to false */
        	'post_title' => true,
        
        	/* (boolean) Whether or not to show the post content editor field. Defaults to false */
        	'post_content' => true,
        
        	/* (boolean) Whether or not to create a form element. Useful when a adding to an existing form. Defaults to true */
          	'form' => false
          );
        acf_form($options);
    

    Thanks for your help!

    Tim

  • Hi John,

    Thanks for your help so far.
    You’re right, it doesn’t load any of the acf files when there isn’t an acf-form at the beginning.
    Do you have any idea if there is function which can be called to only load those files?
    So what I mean asking is if there is a way to get all the files loaded, even if there isn’t an acf-form.

    Thanks a lot!

    Tim

Viewing 11 posts - 1 through 11 (of 11 total)