Support

Account

Forum Replies Created

  • Thank you for your reply. Though not much help to my situation I would caution you on not using add_editor_style(). if you enqueue your css with a different method, your styles will not be applied to previews like blocks and patterns (maybe even style previews though I haven’t confirmed this).

    Ideally we should be able to exclude an element from a page. Like “apply these styles to this page but ignore all divs with the class of .acf-block-component” something like:

    
    :not(.acf-block-component) {
    @import "links"
    ... ect ...
    }
    
    // in the editor this would output something like:
    
    .editor-styles-wrapper :not(.acf-block-component) a { color: blue }
    

    naturally this will not work. and since there does not seem to be an easy way around this. I’d propose ACF be much more specific with their block editor styles even at the risk or breaking the WordPress branding. I’d rather see a ACF themed block editor than a busted one that I have to manually fix every build. just my 2 cents, would still love to hear if anyone has an elegant solution to this issue.

  • late reply but you can use is_admin() to see if you are in the backend. then change the <a> to a <div> so it can’t be clicked.

  • Awesome Thank you John. the $_GET was the missing piece. I was actually unable to access the variable with $_GET but $_POST and $_REQUEST both seemed to work. Thanks again.

  • adding .trigger("change"); seems to have solved the problem.

    final code:

    $(address_field).val(obj.address).trigger("change");

    Thanks

  • anyone else having issues with this, I managed to solve this by rewriting the acf_rendered_block() – so not an ideal solution but it works for now.

    <?php
    
    require '../../../../../wp-load.php';
    
    switch_to_blog( 2 );
    
    $ad = ( is_numeric( $_REQUEST['p'] ) ) ? $_REQUEST['p'] : '';
    
    if ( ! empty( $ad ) ) {
    	$ad = new WP_Query(
    		array(
    			'p'         => $ad,
    			'post_type' => 'ad',
    		)
    	);
    
    	$blocks = parse_blocks( $ad->posts[0]->post_content );
    	foreach ( $blocks as $block ) {
    		if ( 'acf/lunchrush-ad' == $block['blockName'] ) {
    			ob_start();
    
    			acf_setup_meta( $block['attrs']['data'], $block['attrs']['id'], true );
    
    			if ( file_exists( __DIR__ . '/block-ad.php' ) ) {
    				$path = __DIR__ . '/block-ad.php';
    			}
    
    			// Include template.
    			if ( file_exists( $path ) ) {
    				include( $path );
    			}
    
    			// Reset postdata.
    			acf_reset_meta( $block['attrs']['id'] );
    
    			$return = ob_get_clean();
    
    		}
    	}
    
    	if ( ! empty( $return ) ) {
    		$return = '<div class="ad-preview">' . $return . '</div>';
    	}
    }
    
    echo $return;
  • I ended up just adding the block to blog 1 and then apply_filters( 'the_content', $ad->posts[0]->post_content ); worked perfectly. So I guess this is more of a bugfix. will report. thanks.

    edit: actually, this did not work. I just noticed that during debugging I added switch_to_blog( 2 ); to acf_register_store() which was why it was working. So I guess I’m still not sure how to proceed, any help would be appreciated. thanks!

  • Thanks John, you have helped me in the past and I appreciate all the work you and Elliot do on ACF. Without ACF, wordpress would never really be a full featured CMS.

    I’ll submit the request to have a developer look at this. hopefully there might be a better way to handle.

    Thanks!

  • I’m sorry I thought this was were we were supposed to submit bugs and not just another forum.

    I understand what you are saying and I have been aware for some time that hidden conditional field don’t get submitted. I guess I’m just struggling to understand how I can submit an empty field, and after a page update the field is then populated with the field below it. If I submit an empty field (whether hidden or not) I would expect it to stay empty. I do understand what you are saying about the shifting IDs, I guess I just don’t agree that this is expected behavior.

    I made a vid here: http://productivemachine.com/acf.mp4 showing what I’m seeing. If this is what is supposed to happen I would like to make a formal request that it be handled differently because it’s breaking several of our sites. And the only solution I can see is to remove any conditional logic we have in our theme but this would cause a lot of clutter in the admin that I’d like to avoid if possible.

    Thanks!

  • This is still marked as unread, did I submit this correctly?

  • John I just wanted to thank you for all your help with this issue. I think I managed to fix it. Anyone else (unlikely but you never know) with this issue I had a mistake in my acf.php I had “min” and “max” as a child of the sub_fields array when they need to be siblings.

    // so this - WRONG
    ...
    "sub_fields" => array (
    	...
    	array (
    		'tabs' => 'all',
    		'toolbar' => 'full',
    		'media_upload' => 1,
    		'default_value' => '',
    		'delay' => 0,
    		'key' => 'field_5880eb5f6122e',
    		'label' => 'Text',
    		'name' => 'the_text',
    		'type' => 'wysiwyg',
    		'instructions' => '',
    		'required' => 0,
    		'conditional_logic' => 0,
    		'wrapper' => array (
    			'width' => '',
    			'class' => '',
    			'id' => '',
    		),
    	),
    	'min' => '',
    	'max' => '',
    ),
    
    // to this - RIGHT
    ...
    "sub_fields" => array (
    	...
    	array (
    		'tabs' => 'all',
    		'toolbar' => 'full',
    		'media_upload' => 1,
    		'default_value' => '',
    		'delay' => 0,
    		'key' => 'field_5880eb5f6122e',
    		'label' => 'Text',
    		'name' => 'the_text',
    		'type' => 'wysiwyg',
    		'instructions' => '',
    		'required' => 0,
    		'conditional_logic' => 0,
    		'wrapper' => array (
    			'width' => '',
    			'class' => '',
    			'id' => '',
    		),
    	),
    ),
    'min' => '',
    'max' => '',

    VICTORY! Thanks again for all your help!

  • Thanks for the info and all your attention. I started debugging. I went to /wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php and into the flex_content block (around line 350) and entered:

    // loop over sub fields
    foreach( array_keys($sub_fields) as $j ) {
    	
    	// extract sub field
    	$sub_field = acf_extract_var( $sub_fields, $j );
    	echo '============ start ============= <br />';
    	var_dump('SUB_FIELD KEY: ' . $sub_field['key']);
    	echo '<br />';
    	var_dump('SUB_FIELD LABEL: ' . $sub_field['label']);
    	echo '<br />';
    	var_dump('SUB_FIELD TYPE: ' . $sub_field['type']);
    	echo '<br />';
    	var_dump('FIELD_KEY: ' . $field['key']);
    	echo '<br />';
    	
    	// attributes
    	$sub_field['parent'] = $field['key'];
    	var_dump('SUBFIELD_PARENT: ' . $sub_field['parent']);
    	echo '<br />';
    	$sub_field['parent_layout'] = $layout['key'];
    	if(empty($sub_field['parent']))
    	{
    		echo '== PARENT EMPTY - Printing $sub_fields ==<br />';
    		echo '<pre>'; print_r($sub_fields);
    	}
    	echo '<br />============ end ============= <br />';
    	echo '<br />';
    	
    	// append to extra
    	$extra[] = $sub_field;
    	
    }

    The output I got was pretty strange. I have a lot of fields in that flex content – all were outputting correctly and then there were two “mystery arrays” at the end that were empty or mostly empty (one just had a “max” key).

    ...
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880edb261233"
    string(24) "SUB_FIELD LABEL: Heights"
    string(21) "SUB_FIELD TYPE: radio"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(34) "SUB_FIELD KEY: field_5880eef761234"
    string(29) "SUB_FIELD LABEL: Fixed Height"
    string(22) "SUB_FIELD TYPE: number"
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(36) "SUBFIELD_PARENT: field_5508921ee1487"
    
    ============ end =============
    
    ============ start =============
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
        [max] => 
    )
    
    ============ end ============= 
    
    ============ start ============= 
    string(15) "SUB_FIELD KEY: "
    string(17) "SUB_FIELD LABEL: "
    string(16) "SUB_FIELD TYPE: "
    string(30) "FIELD_KEY: field_5508921ee1487"
    string(18) "SUBFIELD_PARENT: f"
    == PARENT EMPTY - Printing $sub_fields ==
    
    Array
    (
    )
    
    ============ end ============= 

    You might have also notice that the subfield['parent'] value is f. super weird since all it’s doing is assigning the field key to it which is displaying the correct value. I’m also not even sure how we are getting here on this last one because the array is clearly empty and we have this if statement to protect against this !empty($sub_fields).

    I’m was thinking the way it’s cutting off on the subfield parent maybe it was due to that max_input_var limit in php, I upped that to 3000 and still getting the same results. I’m running php 7.1, any ideas?

  • Okay so I have no idea what I’ve done but that field went away. It was still there this weekend, but it’s not there now…no idea, and sorry for any headaches.

    but my logs are quickly filling up with those errors I mentioned above, any idea what those are all about? they happen when I hit the front end and also while editing in that admin. In the admin they get error every couple seconds so like I said my logs are busting at the seams.

    edit: if I comment out the “card” code the errors stop so it’s definitely having to do with that. There is probably something else I need to edit to add that to that repeater.

  • I did notice that I’m getting these errors in my logs:

    [Sat Jan 21 12:56:04.473282 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 361, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473335 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent_layout' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 362, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473347 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 361, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473354 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent_layout' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 362, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473667 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 289, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473675 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 318, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473690 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 289, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473698 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'type' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 318, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473876 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 322, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473888 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'menu_order' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 173, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473895 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'parent' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 322, referer: http://CLIENT_NAME.dev/health/
    [Sat Jan 21 12:56:04.473900 2017] [php7:warn] [pid 25014] [client 127.0.0.1:35685] PHP Warning:  Illegal string offset 'menu_order' in /var/www/fr/CLIENT_NAME/wp-content/plugins/advanced-custom-fields-pro/core/local.php on line 173, referer: http://CLIENT_NAME.dev/health/

    Also worth noting how this all came about is I have a acf file that I use for all my themes and for the most part it works fine across the board but for this client I needed to add something to a repeater the file. so I created that card element, then exported, and then copy and pasted it in between those comments. so maybe there is something that need to change elsewhere?

  • whoops second try

  • dang, I actually don’t have any. I’m importing from a php file. I’ve attached the file. It’s pretty big but I place a comment:

    //
    //================================
    // CARD 
    //================================

    This is the element that is giving me problems. The fields shows at the bottom of this field set.

  • Thanks @elliot

    acf_local()->groups[ 'group_55009056525c1' ]['location'] = array( ... );

    This snippet worked perfectly! Thanks again for a great product and amazing support!

  • Thanks Jonathan!

    I actually tried to comment those couple lines out (just to see if it would work) and still had no luck, but looking forward to finding out if there is a solution from elliot.

    Thanks again

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