ACF Repeater Fields in Elementor with Code Snippets - Advanced Custom Fields - FREE CODE

Sdílet
Vložit
  • čas přidán 8. 09. 2023
  • Big thanks to Diana Nichols: diananichols.com/ for her code that I;ve adapted to give you ACG Repeater Fields within Elementor.
    Now you can show the Repeater Fields form ACF Pro inside of your Elementor Single Post Templates.
    All with Code that you can add pain-free with Code Snippets for FREE!
    CODE IS IN THE PINNED COMMENT BELOW
    ACF Repeater Fields in Elementor with Code Snippets - Advanced Custom Fields - FREE CODE
    Join our 'How to Start a Web Design Business' Course - and use strategies to grow, get clients, and generate recurring income: websquadron.co.uk/how-to-star...
    Book your 1-2-1 Consultation: websquadron.co.uk/socials
    We love to create - share - respond - and deliver.
    🧐 Learn with our Mastery Modules: websquadron.co.uk/web-design-...
    🔗 All of our Important Links: websquadron.co.uk/socials/
    😃 Join our Facebook Group: / 3309523509284305
    😃 Get Code Snippets Pro: r.freemius.com/10565/3304295/
    😃 Get Elementor Pro: be.elementor.com/visit/?bta=2...
    😃 Boost your CZcams Analysis: www.tubebuddy.com/websquadron
    👕 Get our Merchandise: websquadron.co.uk/merchandise
    🥹 Support us: paypal.me/Websquadron
    Hire us to work on your Website!
    💌 info@websquadron.co.uk
    👩‍💻 Visit websquadron.co.uk
  • Jak na to + styl

Komentáře • 64

  • @websquadron
    @websquadron  Před 10 měsíci +5

    FULL CODE:
    /* WITH BULLETS
    shortcode for displaying required posting repeater field from ACF*/
    add_shortcode ('show-required', 'dnlt_show_required');
    function dnlt_show_required() {
    $pageID = get_the_ID(); // not required if within loop, but doesn't hurt
    $content= '';
    if( have_rows('subjects_studied', $pageID) ) {
    $content .= '';
    while( have_rows('subjects_studied', $pageID) ) {
    the_row();
    $content .= '' . get_sub_field('subjects') . '';
    }
    $content .= '';
    }
    return $content;
    }
    /* WITH NO BULLETS
    shortcode for displaying required posting repeater field from ACF*/
    add_shortcode('show-required', 'dnlt_show_required');
    function dnlt_show_required() {
    $pageID = get_the_ID(); // not required if within loop, but doesn't hurt
    $content = '';
    if (have_rows('subjects_studied', $pageID)) {
    while (have_rows('subjects_studied', $pageID)) {
    the_row();
    $content .= get_sub_field('subjects') . ''; // Use for line breaks
    }
    }
    return $content;
    }
    /* WITH COMMAS AND NO BULLETS
    shortcode for displaying required posting repeater field from ACF */
    add_shortcode('show-required', 'dnlt_show_required');
    function dnlt_show_required() {
    $pageID = get_the_ID(); // not required if within loop, but doesn't hurt
    $content = '';
    $subjects = array(); // Create an array to store subjects
    if (have_rows('subjects_studied', $pageID)) {
    while (have_rows('subjects_studied', $pageID)) {
    the_row();
    $subjects[] = get_sub_field('subjects'); // Add each subject to the array
    }
    }
    // Use implode to join subjects with commas and create the content
    $content = implode(', ', $subjects);
    return $content;
    }

  • @METANAnima
    @METANAnima Před 6 měsíci +1

    that was really nice and helpful, helped me get the complete concept of acf groups and repeaters.

  • @thegeomaster
    @thegeomaster Před 9 měsíci

    Fabulous... I've adapted it to create a gallery showing video containers, as there is no way to show "archive" type fields created with ACF in Elementor.

  • @heinvanvlastuin4954
    @heinvanvlastuin4954 Před 10 měsíci +1

    I like your approach. This is a very realistic approach.

  • @WordStudioAI
    @WordStudioAI Před 3 měsíci

    Thank you! Very helpful. I am looking for a way to do this with a repeater field with oembeds repeating. That way I can make a video gallery/grid.

  • @akshaysrivastavaofficial
    @akshaysrivastavaofficial Před 6 měsíci +1

    It is a shame that Elementor Pro has not yet added the support to repeater field and AVIF image for Lightbox.

  • @hainp1406
    @hainp1406 Před 2 měsíci

    I have added okay, but there are 10 or more. How to Paginate using Ajax? Looking forward to sharing.

  • @jomotioncreative
    @jomotioncreative Před 2 měsíci

    This worked like a charm! Question: I created multiple shortcodes to use (text, image, WYSIWYG fields) and added to an Elemetor template and is pulling in correctly. The problem is when I add additional rows (content) - it stacks the fields, as opposed to creating an entirely new section of my repeater fields/ layout. Do I have to wrap all of these shortcodes in a main container so they don't stack on top of each other? or am I missing something else? thanks!

    • @websquadron
      @websquadron  Před 2 měsíci +1

      Possibly yes, or set it as a row.

  • @RobLicopoli
    @RobLicopoli Před 6 měsíci

    Thank you for this!

  • @webwithwaleed
    @webwithwaleed Před 5 měsíci

    Pro tip use chatgpt to style the output or basically do anything what you need i do it for myself and its amazing i want the output data to be inside a box blalalalal and the caht gpt did a great job

  • @stephencree3076
    @stephencree3076 Před 4 měsíci

    Thanks, Imran! Really helpful

  • @Donny2801
    @Donny2801 Před 4 měsíci +1

    This guy is hero :')

  • @fredrikolsson4080
    @fredrikolsson4080 Před 8 měsíci

    Should it also work for all kind of templates? For example a product archive template instead of a post type template? I can't get it to work with product archive template.

    • @websquadron
      @websquadron  Před 8 měsíci

      I'll have to test it, but it should

  • @specmedianz
    @specmedianz Před 7 měsíci

    Great Video mate, could this be done using font awesome icons like a tick or check? Appreciate this, it's a much cleaner way, I've been using Dynamic ooo to achieve it and only using that plugin for the reapeater. Now I can avoid that particular plugin :)

    • @websquadron
      @websquadron  Před 7 měsíci

      Hmmmm, not thought of that, I'll have to check.

  • @justindouglas3659
    @justindouglas3659 Před 10 měsíci

    Hey could you do one where you create a custom acf field for phone numbers??? Since i know acf doesnm't have that option / field in free or pro version.

    • @websquadron
      @websquadron  Před 10 měsíci

      You could use the number field or telephone - and then when you show it on Elementor - maybe add tel: before it. I think…

  • @sallamkashif
    @sallamkashif Před 6 měsíci

    can we do this with Flexible Content?

  • @ExWest
    @ExWest Před 10 měsíci

    This is awesome. One question though. I have a file field that is supposed to be shown by a text link. You can click it and download a PDF. I got that to work but now it shows up even when there is nothingg uploaded. Any help?

  • @samarjit7057
    @samarjit7057 Před 10 měsíci

    @websuadron for making this video...and continue for acf for directory listing website

  • @azrakadric8597
    @azrakadric8597 Před 5 měsíci +1

    Amazing, thank you! In my case, i had a repeater field with 2 subfields. This is how I displayed both of them and assigned them css classes for further css writing.
    add_shortcode('show-required', 'dnlt_show_required');
    function dnlt_show_required() {
    $pageID = get_the_ID(); // not required if within loop, but doesn't hurt
    $content = '';
    if (have_rows('subjects_studied', $pageID)) {
    while (have_rows('subjects_studied', $pageID)) {
    the_row();
    $content .= '' . get_sub_field('yourfieldname1') . '
    ' . get_sub_field('yourfieldname2') . '';
    }
    }
    return $content;
    }

    • @websquadron
      @websquadron  Před 5 měsíci

      Impressive :)

    • @azrakadric8597
      @azrakadric8597 Před 5 měsíci

      @@websquadron hope it can help someone out!

    • @azrakadric8597
      @azrakadric8597 Před 5 měsíci

      Also, for a table display (additional code snippet is made)
      add_shortcode('show-repeater-table-view', 'dnlt_show_repeater_table_view');
      function dnlt_show_repeater_table_view() {
      $pageID = get_the_ID(); // not required if within loop, but doesn't hurt
      $content = '';
      if (have_rows('subjects_studied', $pageID)) {
      $content .= '


      NAME OF YOUR TABLE HEADER FIELD 1
      NAME OF YOUR TABLE HEADER FIELD 2
      NAME OF YOUR TABLE HEADER FIELD 3';
      while (have_rows('subjects_studied', $pageID)) {
      the_row();
      $content .= '

      '. get_sub_field('yourfieldname1') . '
      '. get_sub_field('yourfieldname2') .' H
      '. get_sub_field('yourfieldname3') .'
      ';
      }
      $content .= '';
      }
      return $content;
      }

  • @YuukaleNarmo02
    @YuukaleNarmo02 Před měsícem +1

    How can I do this with nested repeaters? This seems the most elusive to achieve

    • @websquadron
      @websquadron  Před měsícem

      Hmmmm... will need a think about that.

    • @YuukaleNarmo02
      @YuukaleNarmo02 Před měsícem

      @@websquadron right now I'm trying to deal with the following situation:
      Event repeater field
      -> Sponsors repeater field
      -> -> sponsor post object
      This post object is a custom post type that also has acf fields, such as an img field called "logo"
      I need to show the "logo" field of that post object dynamically (as there'll be multiple sponsors and their logos per event)

  • @valeraabramchuk6322
    @valeraabramchuk6322 Před 5 měsíci

    Thanks very helpful.
    Is it possible to output images from a repeater?

    • @valeraabramchuk6322
      @valeraabramchuk6322 Před 5 měsíci +1

      solved it with the following code
      add_shortcode('show-required', 'dnlt_show_required');
      function dnlt_show_required() {
      $pageID = get_the_ID();
      $content = '';
      if (have_rows('icon', $pageID)) {
      while (have_rows('icon', $pageID)) {
      the_row();
      $image = get_sub_field('icon-image');
      if( !empty( $image ) ) {
      $content .= '';
      }
      }
      }
      return $content;
      }

    • @websquadron
      @websquadron  Před 5 měsíci

      Good question, not tried that myself.

  • @robertostringa9254
    @robertostringa9254 Před 6 měsíci

    Does it not work when used inside the Loop grid?

  • @rararaheem
    @rararaheem Před 10 měsíci +5

    Good Job dad

    • @websquadron
      @websquadron  Před 10 měsíci +3

      Cheers Raheem. I hope you'll turn your computer soon.

    • @rararaheem
      @rararaheem Před 10 měsíci +3

      I am up stairs

  • @danstevens1974
    @danstevens1974 Před 10 měsíci

    Or you could use Breakdance or Bricks that both handle the Repeater Field Natively.

    • @websquadron
      @websquadron  Před 10 měsíci +1

      Indeed, but the video was for Elementor :) :)

    • @danstevens1974
      @danstevens1974 Před 10 měsíci

      @@websquadron indeed - but some people may be interested to learn different ways to skin the cat!

    • @Elsteck
      @Elsteck Před 10 měsíci

      That is what this tutorial is for, the cat can finally be skinned with Elementor@@danstevens1974

    • @RobLicopoli
      @RobLicopoli Před 6 měsíci

      @@danstevens1974Yea, but this was for Elementor. There are other tutorials for Bricks and other worse builders such as Bricks

  • @abhishekgarg1030
    @abhishekgarg1030 Před 2 měsíci

    But how to achieve this with slider

    • @websquadron
      @websquadron  Před 2 měsíci

      Add to loop carousel

    • @abhishekgarg1030
      @abhishekgarg1030 Před 2 měsíci

      @@websquadron I have tried under loop carousel I have created a template but that is not taking repeater fields

  • @dsuinfotech
    @dsuinfotech Před 8 měsíci

    Using this code Video not coming

    • @websquadron
      @websquadron  Před 8 měsíci

      Are there any JS errors when you inspect the page?

  • @SebastianPerezG
    @SebastianPerezG Před 10 měsíci +1

    What a flaw of elementor .... you support ACF but not all the fields ??? also this happens in the pro version of elementor. Is Horrible.
    Also , elementor doesn't have a simple table widget , why ???

    • @websquadron
      @websquadron  Před 10 měsíci

      I'm sure they'll roll out some support for the other ACF fields soon. As for the Table Widget, it's easier to add with HTML but I hear what you're saying. I can't speak for why they haven't added in Table widgets.

    • @Elsteck
      @Elsteck Před 10 měsíci

      Hmm, I have been waiting 5 years for Elementor to support the other ACF fields now, have given up @@websquadron

    • @SebastianPerezG
      @SebastianPerezG Před 10 měsíci +1

      @@websquadron I saw many github requests telling that and i don't know why they do not do that, also you can't see any grouped fields.

    • @multa7053
      @multa7053 Před 10 měsíci

      @@SebastianPerezG There's lots of things that are needed. Best example is a submenu that's active (aka. you have clicked on it). When that's the case, the menu doesn't show the selected menu item as active. Why? No idea. Makes no sense honestly.

    • @SebastianPerezG
      @SebastianPerezG Před 10 měsíci

      @@multa7053 Yes , i mean , i think Brick has better support on this , Elementor has some features that do not care to anyone and they are pointless , like the Curve text ... how many websites are you gonna use this?
      Also they have a very horrible the support on creating a custom widget for elementor, i mean they don't have a good example on how to use the entire library also very few tutorials explaining how to make one and the ones are very limited or basic.

  • @TizianoFracas
    @TizianoFracas Před 5 měsíci +1

    Grazie.

    • @websquadron
      @websquadron  Před 5 měsíci

      Bless you :)

    • @websquadron
      @websquadron  Před 5 měsíci

      Do share the video (click the share button to get the right URL) and let the world know :)