Home › Forums › General Issues › Tablepress and ACF
Hey Community,
i would like to create custom tables with tablepress.
My idea is that I build myself a scaffolding, which I basically only have to duplicate.
for example I have 5 columns. the columns 4 -5 should all be acf queries. only the column is edited.
<figure class="wp-block-table alignwide">
<table>
<tbody>
<tr>
<td>Produkt-Name</td>
<td>Hersteller</td>
<td>Bild</td>
<td>Normaler Preis</td>
<td>Aktionspreis</td>
</tr>
<tr>
<td>Name_1</td>
<td><?php the_field('hersteller'); ?></td>
<td><?php the_field('image'); ?></td>
<td><?php the_field('price_normal'); ?></td>
<td><?php the_field('price_offer'); ?></td>
</tr>
<tr>
<td>Name_2</td>
<td><?php the_field('hersteller'); ?></td>
<td><?php the_field('image'); ?></td>
<td><?php the_field('price_normal'); ?></td>
<td><?php the_field('price_offer'); ?></td>
</tr>
<tr>
<td>Name_3</td>
<td><?php the_field('hersteller'); ?></td>
<td><?php the_field('image'); ?></td>
<td><?php the_field('price_normal'); ?></td>
<td><?php the_field('price_offer'); ?></td>
</tr>
<tr><td>Name_4</td>
<td><?php the_field('hersteller'); ?></td>
<td><?php the_field('image'); ?></td>
<td><?php the_field('price_normal'); ?></td>
<td><?php the_field('price_offer'); ?></td>
</tr>
</tbody>
</table>
</figure>
Can I even do that with tablepress? Or does it make more sense to create a new CPT and use a single-XXX.php template?
Thanks, Karsten
I have no experience with TablePress but the image looks like you are adding a table within the Gutenberg editor. You can’t put plain PHP into the editor. What you need is a repeater field with the respective fields in each row, and then you would construct a table from the output.
I have now solved the whole thing completely different!
Instead of a table I opted for a dynamic container … looks more elegant and makes the whole thing much easier in connection with ACF!
Can I ask what you mean by a dynamic container, and what that solution looked like?
You must be logged in to reply to this topic.
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.