Support

Account

Home Forums Add-ons Repeater Field Build a Table with Repeaterfield

Solved

Build a Table with Repeaterfield

  • Hello,

    i want to build a table and put some fields from repeater addon into it.
    But its dont really work. I use the Visual Composer Plugin and a Plugin that is name is -> insert php. So i can display php code on the frontend with my composer.

    So: This is my code:

    insert_php]
    
    // Wenn mindestens 1 Datensatz vorhanden ist
    if( have_rows('stellen_ds') ) {
    <table><tr><td>Stelle</td><td>Ort</td></tr>
    while( have_rows('stellen_ds')) : the_row();
    
    // Bezeichnung aus Feld laden
    $bezeichnung = get_sub_field('bezeichnung');
    
    // Ort aus Feld laden
    $ort = get_sub_field('ort');
    
    // Anhang Text aus Feld laden
    //$anhang = get_sub_field('anhang');
    
    echo '<tr><td>';
    echo $bezeichnung;
    echo '</td><td>';
    echo $ort;
    echo '</td></tr>';
    
    // 3 Felder ausgeben
    
    //echo $anhang;
    
    endwhile;
    
    echo '</table>';
    }
    
    [/insert_php]

    Can you look over it? Is it right?

    Greetings

  • What is being added to the page? Anything?

  • Yes, all to the Page. When its done it should like this page make dynamic:

    on the right where is a Job table and i Need this dynamic.

    Greetings

  • More than likely there is a problem with ACF finding the right post to get the information from, you may need to tell ACF what post id to get it from

    
    [insert_php]
    
    global $post;
    
    // Wenn mindestens 1 Datensatz vorhanden ist
    if( have_rows('stellen_ds', $post->ID) ) {
    <table><tr><td>Stelle</td><td>Ort</td></tr>
    while( have_rows('stellen_ds', $post->ID)) : the_row();
    
    // Bezeichnung aus Feld laden
    $bezeichnung = get_sub_field('bezeichnung');
    
    // Ort aus Feld laden
    $ort = get_sub_field('ort');
    
    // Anhang Text aus Feld laden
    //$anhang = get_sub_field('anhang');
    
    echo '<tr><td>';
    echo $bezeichnung;
    echo '</td><td>';
    echo $ort;
    echo '</td></tr>';
    
    // 3 Felder ausgeben
    
    //echo $anhang;
    
    endwhile;
    
    echo '</table>';
    }
    
    [/insert_php]
    
  • Thanks! 🙂 worked!

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

You must be logged in to reply to this topic.