Support

Account

Home Forums General Issues Tablepress and ACF

Solved

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> 

    Preview

    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?

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

You must be logged in to reply to this topic.