Home › Forums › Add-ons › Repeater Field › 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
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]
The topic ‘Build a Table with Repeaterfield’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.