Support

Account

Forum Replies Created

  • Here are two additions in case you a) want to have a unified message for all ACF blocks without ACF fields or b) want the message to disappear completely.

    // ACF Blocks: Alter message for all ACF blocks that contain no ACF fields
    
    function no_fields_message($message) {
    
      $message = __('No fields for this block', 'projectname');
    
    	return $message;
    
    }
    
    add_filter ('acf/blocks/no_fields_assigned_message', 'no_fields_message', 10, 2);
    // ACF Blocks: Remove no-fields message for all ACB blocks without ACF fields
    
    add_filter( 'acf/blocks/no_fields_assigned_message', '__return_empty_string' );
  • @giray Nope, that seems to have been a general error,– happened to me as well, and now it’s working. I think they messed up for a bit when releasing the update 😊.

  • I highly suggesting contacting support directly, and not waiting here.
    In my case it wasn’t the .pet domain, but an EMOJI I use in the site title which caused the trouble for activation for ACF (it showed as activated on my site, but ACF.com didn’t list it as activated). I wouldn’t have found out on my own, and without contacting them directly.

  • Hi there, not sure if it’s still clever to post/ask here instead of going through the support e-mail hoops.
    I experience the same problem on quite exactly one site at the moment, which is a .pet (yes, you read right) domain. No matter how often I activate and deactivate, the site never appears on the activated sites list in my ACF account,- may it have something to do with the TLD I use for the site? Doesn’t the ACF team like CUTE ANIMALS :D?

  • Hey @proxxim ,

    in case you’re still wondering, I could easily just put it in a enqueued JS file that loads in the backend, and the colour picker only offers up theme colours which are defined for Gutenberg via theme.json. No need to wrap the code above, and you can easily enqueue the JS like normal (the CSS file is not needed though):

    function load_admin_stuff() {
    	wp_enqueue_style( 'admin_css', get_stylesheet_directory_uri() . '/css/admin.min.css', false, '' );
        wp_enqueue_script( 'admin', get_template_directory_uri() . '/js/admin.min.js', array(), '', true );
    };
    
    add_action( 'admin_enqueue_scripts', 'load_admin_stuff' );

    Can’t help you with the terms stuff, though I would suppose ACF just reads the values from Gutenberg, but doesn’t necessarily need Gutenberg to be loaded.

  • And I just solved it myself. You need to create an array and fill it with each and every file’s ID, off you go:

    function default_photos( $field_photos ) {
    		
        $photos = get_field('artist_photos', 'option');
    	
    	$array = array();
    
    	foreach ($photos as $photo) {
    		$id = $photo['ID'];
    		array_push($array, $id);
    	};
    		
         $field_photos['default_value'] = $array;
         return $field_photos;
    		 
    }
    
    add_filter('acf/load_field/name=press_photos', 'default_photos');
  • Hey @inhouse ,

    I know I’m late to the party, but had a bit of a hard time getting my head around previews as well and found out how to cope with it.
    You can enqueue your styles and/or scripts like so:

    
    	acf_register_block_type(array(
    		// your other arguments
    		'enqueue_assets' => 'blockname_assets',
    	));

    and then have a conditional enqueue like this:

    // Enqueue scripts & styles if frontend
    function blockname_assets() {
    	// Frontend loading
    	if(!is_admin()) {
    		wp_enqueue_style('blockname', get_template_directory_uri() . '/css/blockname.min.css' );
    		wp_enqueue_script('blockname', get_template_directory_uri() . '/js/blockname.js', array(), '', true );
    	}
    }

    and extend it, so that different enqueues are happening for backend and frontend. Does that help you already 🙂 ?

  • Hey @eaglejohn , how did you exactly proceed? I included first the part from the required.php and then the snippet from the functions.php in my own functions.php file. Files seem to upload, and appear as gallery images in the post created, though I get a warning after form submission:

    Warning: pathinfo() expects parameter 1 to be string, array given in /xxx/xxx/xxx/xxx/xxxx.de/wp-content/plugins/gravityforms/forms_model.php on line 4375

    Anything I am doing wrong here?

  • Hey John, thanks for the link (and sorry for the delay in responding)! Is there a way via acf_get_setting to not only get the current or default language, but a language of choice?

    What I actually need and am working on is a foreach loop through all WPML languages and the retrieval of a specific field from the options for each of the languages, to be exact.

    Thank you in advance!

  • Would be interested to know as well, since I often use clones within a group, this creates unnecessary wrapping, would love to have conditional logic in either way as well.

  • +1, highly needed 😉!

  • Thank you, @qb16 , that helped a lot. Has become quite a hassle to get a simple map with a tiny marker setup with ACF to display on a website (not ACF’s fault though), thanks for helping out!

  • Given that this thread and problem is so old already (and had been reported before), did anyone come up with a solution? I have developed a very basic columns shortcode based on flexbox, and though I can hide empty paragraphs with CSS, it’s still a bit risky and not very beautiful to have trash in the code :).

    Would love to hear from someone possibly having cracked this thing :).

  • You won’t even need to come here, since the documentation has the right code now as well ;). I have a private little database of code snippets put into Evernote, and I hurried to add this little thing to it for the next time I need it.

    You could probably mark my post with the code as the solution, so others coming here find it right away ;).

    Good luck with the next 25(0) projects then ;).

  • I was kidding. Real hard, actually.
    I am just glad this has been solved, so I can pin on the next problems to solve them ;).
    Is this solution still of value to you, after such a long time?

  • It looks like it. The documentation seems to have been updated with it, too: http://www.advancedcustomfields.com/resources/acf-fields-relationship-query/ .

    Is 16 months a long time on the interweb :)?

  • Elliot finally got it going for me through personal support. If anyone is still interested, here is the code:

    /* ACF: limit child-page selection to current page’s children */
    
    function childpages_query( $args, $field, $post_ID )
    {
        $args['post_parent'] = $post_ID;
    
        return $args;
    }
    
    add_filter('acf/fields/relationship/query/name=pages_childpages', 'childpages_query', 10, 3);

    while pages_childpages is the relationship field. It finally works in my case ;).

  • Being on ACF Pro 5.3.2.2 it still doesn’t seem to work. When I add it to my functions.php, and I really took care of it being proper, I only get a spinning loading animation, but no pages are being shown which I could select. If I leave off the filter, the field then works well (but of course showing all instead of only pages of the current page). Or did I miss anything here?

    Code is standard:

    function childpages_query( $args, $field, $post )
    {
        $args['post_parent'] = $post->ID;
    
        return $args;
    }
    
    add_filter('acf/fields/relationship/query/name=pages_childpages', 'childpages_query', 10, 3);

    Thanks for any help in advance ;).

  • A bit late to the party, but in hunt of the same things, since I have to loop shortcodes into shortcodes in order to have my users comply with the design/structure needed. It would be easier to work with attributes generated through an ACF field group, so e.g. a URL of a post picked via ACF is turned into an attribute or an image picked turns into a specific size’s URL etc.

    Any progress of any kind from anyone? Different solutions :)?

  • I can confirm Elliot seems to have silently gotten rid of the problem, since all my problem children are now able to connect to the license server and updated accordingly.

  • F*ck, that bug (?) just cost me a whole lotta time… thanks for pointing this out, Jeff, really appreciated! Now it is saving properly, phew!

  • Dear @wwdboer ,

    you just officially saved my day – thank you so much <3!

  • Yeah, and Strato has no idea and crappy support, no way of solving this, @frances .


    @elliot
    still not working, sorry.

  • Hi @elliot ,

    same here. Tried to solve it with the hoster via e-mail tickets for weeks, no dice, and still not working since you changed your hosting stuff, unfortunately 🙁 .

    Cheers²

  • Hi there,

    this seems to be connected to some kind of server settings on some hosting environments. I have just discovered that two sites hosted on Strato (strato.de) are affected by the connection issues and won’t let me install my license and update accordingly. Did anybody come up with some kind of fix? I presume it is something on the hoster’s end and we cannot do much about it, but it would be good if we could point out what the actual problem is. ACF support was kind, but has no clue, since it seems server related.

Viewing 25 posts - 1 through 25 (of 48 total)