Forum Replies Created

  • Hey Guys,

    This is possible already.

    Here is the post about it:

    And the code which helps you to make better experiences! : )
    The magic is that, you need to wrap them with a data []

    'template' => [
         ['acf/my-block', [
           'data' => [
            'field_name' => 'the value you want to see by default',

    I hope it helps you too as well!

    I’m stuck with repeater subfields now.
    Didn’t find a way to fill them yet.
    If any of you able to do that, don’t hesitate to write here about that. 😉


  • Hey @anybodesign

    You should able to do that via get_posts() too.

    The most problem you don’t use the proper order value for that.
    I think you want to change the ‘order’ like this:

    $posts = get_posts([
    	'post_type'		=> 'product',
    	'meta_key'      => 'your_date_field',
      	'orderby'       => 'meta_value_num',

    The key is the meta_value_num when you order by number / date type of fields

  • Hey @webbmaster ,

    You should unwrap the field from <p> tags, so let it:

    echo $background['del1'];
  • Hey @panayotoff ,

    Thank you for your share, it helped me a lot!

    Did you able to fill up repeater type of fields too?
    It seems not to work for me with those type of fields.

  • Hey @varilux2k ,

    It seems you’re using JavaScript ( JQuery > $ ) within PHP tags wrongly.

    PHP solution:

    if (!wp_is_mobile()) {
    echo $slider_image['url'];
    } else { 
    echo $slider_image_mobile ['url'];

    HTML solution:

       <source media="(min-width: 36em)"
          srcset="large.jpg  1024w,
             medium.jpg 640w,
             small.jpg  320w"
          sizes="33.3vw" />
       <source srcset="cropped-large.jpg 2x,
             cropped-small.jpg 1x" />
       <img src="small.jpg" alt="A rad wolf" />

    JavaScript solution ( if you extend your html with data attr ):

    var imageBgs = document.querySelectorAll('[data-bg-mobile]');
    var screenWidth = window.innerWidth;
    for(var i=0; i<imageBgs.length; i++) {
        if( screenWidth < 576 ){
            // Load mobile image
            imageBgs[i].style.backgroundImage = 'url('+imageBgs[i].getAttribute('data-bg-mobile')+')';
  • Hey @wpfreshysites-com

    Yes, you could this by target the proper field type:

    // ACF > WYSIWYG — Custom Toolbar
    	add_filter( 'acf/fields/wysiwyg/toolbars', function ( $toolbars ) {
    		// Unset Basic Type Toolbar
    		unset( $toolbars['Basic'] );
    		// [1] formatselect. bold, italic, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, wp_more, spellchecker, fullscreen, wp_adv
    		// [2] strikethrough, hr, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help
    		// Register a basic toolbar with a single row of options
    		$toolbars['Full'][1] = [ 
    		$toolbars['Full'][2] = [];
    		return $toolbars;
  • +1

    It’d saves plenty of times, and give us the real power to use acf blocks as template

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