ACF Repeater for registering Gutenberg Blocks

I am working on a template where I want to make a function that I can use the repeater field from ACF to combine that with the acf_register_block_type();.

What I have is the following:

 <?php          $  rows = get_field('register_block');     if( $  rows ) {         foreach( $  rows as $  row ) {           $  register_block_name_function = $  row['register_block_name'];           $  register_block_name = $  row['register_block_name'];             function $  register_block_name_function() {                      acf_register_block_type(array(                     'name' => $  register_block_name,                     'title' => __('3 Columns'),                     'render_template' => '/acf/blocks/gutenberg/columns-3.php',                     'category' => 'blocks',                     'mode' => 'auto',                     'supports' => array(                         'align' => true,                         'mode' => true,                         'anchor' => true,                     ),                     'icon' => array(                       // Specifying a background color to appear with the icon e.g.: in the inserter.                       'background' => '#B53A73',                       // Specifying a color for the icon (optional: if not set, a readable color will be automatically defined)                       'foreground' => '#FFF',                       // Specifying a dashicon for the block                       'src' => 'align-left',                     ),                 ));                  }                  // Check if function exists and hook into setup             if (function_exists('acf_register_block_type')) {                 add_action('acf/init', $  register_block_name_function);             }              }     }   ?> 

Is there a way that I can use 1 ACF Repeater to create multiple Gutenberg bocks by just adding a name.

Use WPQuery to match to specific repeater row in post

So i have a repeater inside post-type ‘properties’ that stores Lot No and Auction Date for all the Auctions a property is in.

When going into an event page, say for 12th August it needs to list all of the properties in this auction in Lot No order.

When i use WP Query i’m doing it as so:

function my_posts_where( $  where ) {    $  where = str_replace("meta_key = 'auctions_$  ", "meta_key LIKE 'auctions_%", $  where);    return $  where; }  add_filter('posts_where', 'my_posts_where');          $  args = array (             'post_type'=>'properties',             'post_status'=>'publish',             'posts_per_page'=> 40,             'paged'=> $  paged,             'suppress_filters' => false,             'meta_query' => array(              'proparray' => array(                'key' => 'auctions_$  _auction_date',                'value' => $  today2,                'compare' => 'LIKE',              ),              'lot-nos' => array(                'key' => 'auctions_$  _lot_no',                'type' => 'NUMERIC',              ),         ),        'orderby' => array(           //  'auction-dates' => 'ASC',             'lot-nos' => 'ASC',         ),           );         $  wpb_all_query = new WP_Query($  args); 

My problem is that it’s picking up Lot Nos from other rows. So if a property has the following date:

Auction Date : 7th June 2020 Lot No: 2 Auction Date: 12th August 2020 Lot No: 14

It is picking up the auction date 12th August 2020, but ordering it as Lot No 2, NOT 14. I need it to match to the specific row of the date in question, then get the Lot No from that row. is this possible?

How to access repeater field of a custom field?

I have a custom post type called donation_group it has a custom_field called donate_pages which is a repeater field. This donate_pages has again fields called donation_object and amount_received. I want to access these custom fields in my controller ie php file.

This is the code I have tried so far

 $  donation_group_posts = Timber::get_posts(array(         'post_type' => 'donation_group'     ));      foreach ( $  donation_group_posts as $  dg_post ) {         $  dg_donate_pages = $  dg_post -> donate_pages;         echo "dg_donate_pages", $  dg_donate_pages;     } 

When I echo dg_donate_pages, I am only getting the number of rows that repeater field has. How can I get its values?

Display all repeater subfield values from DB

Here is the thing – I’m working on a personal project which includes multiple custom fields (created via ACF). Few of them are repeater types.

What I want to achieve is to display 3 arrays/blocks of those repeater subfield values. For better understanding, I have this repeater field: open_workshops, and this field includes subfields: date, location, partnerships.

I want simply to show all values from those subfields stored in DB. Something like:

Open Workshops:

  • Date: Jan 2017, Feb 2017…Dec 2019 etc

  • Location: New York, Warsaw…

  • Partnerships: EY, Google..

What issues I’ve noticed – first of all, because of field type (repeater) it’s damn hard to find those values in the DB. Because its not a single field but ACF replicates their names, so instead of looking for single field: open_workshops_date i need somehow to find: open_workshops_0_date, open_workshops_1_date etc.

My initial code was:

  if( have_rows('open_workshops') ):         while ( have_rows('open_workshops') ) : the_row();             $  sub_value_1 = get_sub_field('date');         $  sub_value_2 = get_sub_field('location');         $  sub_value_3 = get_sub_field('partnerships');             echo '$  sub_value_1'; echo '$  sub_value_2'; echo '$  sub_value_3';          endwhile;     else :         // no rows found     endif; 

I’ve tried as well the suggestion from this post: Retrieving all data from repeater fields

but it shows nothing.

Use modulo condition in ACF repeater Field

I want to make a modulo condition in my ACF Repeater field.

In a while loop, I want my code different if $ j is odd or even.

My code:

<div class="container grow mt-5"> <h1 class="text-center">Expositions</h1>  <?php     $  j = 1;     if( have_rows('expos') ):         while ( have_rows('expos') ) : the_row();         $  titre= get_sub_field('titre');         $  img = get_sub_field('image');         $  contenu = get_sub_field('contenu');          if ($  j%2 == 1) {         echo '           <div class="row mt-5">             <div class="col-4">                 <img class="thumbnail" src="'.echo esc_url($  img['url']);.'" alt="'.esc_attr($  img['alt']);.'" />                 </div>             <div class="col-8">                 <h2 class="text-center">'.$  titre.'</h2>                 <p>'.$  contenu.'</p>             </div>             </div>'     } else {         echo '          <div class="row mt-5">             <div class="col-8">                 <h2 class="text-center">'.$  titre.'</h2>                 <p>'.$  contenu.'</p>             </div>             <div class="col-4">                 <img class="thumbnail" src="'.echo esc_url($  img['url']);.'" alt="'.esc_attr($  img['alt']);.'" />                 </div>               </div>'     };       $  j++;     endwhile;     else :         echo '<p class="text-center">No content !</p>';     endif;     ?>  </div>   

It doesn’t work.

Where is my error ?

Burp Suite – Use \n in repeater

Currently I am trying to fuzz the request I sent to Repeater. However if I put a new line (using Enter key) inside repeater’s text window, burp on background really creates a crlf.

My goal:

Send a request, which contains only a newline without carriage return.

What I tried

I tried to use \n (as it is common in a lot of programming languages). However burp’s Repeater treats \n as set of two characters – \ and n.

burp repeater


Is there any way how to pass standalone newline character without carriage return inside Request stored in Repeater?

So far I tested this using my workaround in bash console, which is not-elegant at all:

curl --header "Content-Length: 1" --header $  '\nTransfer-Encoding: chunked' 

Any insights appreciated.

functionality similar to ACF repeater? User to add points

I have custom post type called “tours” , user adds post called “london tour” as a title . And then i want user to be able to add tour stops, which will be displayed in front end with fontawesome icons , as a stylised list . I don’t want to include full text editor, just some kind of field with ability to add next field.

My only though was to have a simple list in content editor, and to use javascript to stylize ‘li’ items etc.

Pagination on WordPress Repeater has stopped working since upgrade to php7.2 suspect issue with count() function

Since updating to php7.2 the pagination function has stopped working on a gallery built with ACF repeater. I suspect it’s an issue with the count() function

I’ve found some articles relating to this but can’t work out how to update my code to resolve the problem. If anyone could help, I’d be super grateful.

My Code below

<?php /*   * Paginate Advanced Custom Field repeater  */  if( get_query_var('page') ) {   $  page = get_query_var( 'page' ); } else {   $  page = 1; }  // Variables $  row              = 0; $  images_per_page  = 15; // How many images to display on each page $  images           = get_sub_field( 'main_gallery_images' ); $  total            = count( $  images ); $  pages            = ceil( $  total / $  images_per_page ); $  min              = ( ( $  page * $  images_per_page ) - $  images_per_page ) + 1; $  max              = ( $  min + $  images_per_page ) - 1;  // ACF Loop if( have_rows( 'main_gallery_images' ) ) : ?>     <div id="gallery" class="main">   <?php while( have_rows( 'main_gallery_images' ) ): the_row();      $  row++;      // Ignore this image if $  row is lower than $  min     if($  row < $  min) { continue; }      // Stop loop completely if $  row is higher than $  max     if($  row > $  max) { break; } ?>                           <?php        $  image = get_sub_field( 'image' );        $  caption = get_sub_field('caption');     ?>     <div class="galleryItem">         <a href="javascript:void(0)" class="enlarge">             <div class="image" style="background-image: url(<?php echo $  image; ?>)">             <span><?php echo $  caption; ?><em>CLOSE X</em></span>             </div>         </a>     </div>   <?php endwhile; ?>     </div> <div class="galPag"> <?php // Pagination   echo paginate_links( array(     'base' => get_permalink() . '%#%' . '/#gallery',     'format' => '?page=%#%',     'current' => $  page,     'total' => $  pages   ) );   ?> </div> <?php endif; ?> 

Site is here:

What should happen is that the pagination links update the url and display the next set of images. What is happening is that the url gets updated but you just get the first set of images displayed again. The ‘next’ link doesn’t update and is always pointing to page2.

Configuring old router as repeater?

I have been at it for about two days and let me give a detailed account of all the settings that I have set.

For the sake of clarity I will call the router which as Internet connection (WAN) as the mainRouter and the old router which I want to use as a repeater as the the secondRouter.

In the screenshots I have the SSID of the mainRouter as iball100 and that of the secondRouter as iballRep

Here are the settings for the mainRouter

Main router settings

And now for the Settings for the secondRouer

enter image description here

The problem that i have is that the secondRouter does not have access to the internet. When I connect to the secondRouter it says “connected,No internet”. I have tried connecting to it using my phone as well still get the same thing.

The secondRouter doesn’t show as a connected client on the mainRouter, is a thing that I observed.

I have no clue as to what am I missing here. The settings that I have work well for youtube videos which I saw, link here.

Any help in this regard will be appreciated.