my code stock.com

Snippet options

Download: Download snippet as matcha-table.html.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<?php
@include_once('config.php');

/**
 * Grundeinstellungen
 */
DynamicTable::setTermId(90); // Kategorie-ID für Tee-Profile
DynamicTable::setMetaKey('wpcf-gesamtergebnis-in-prozent'); // Meta-Key für die Sortierung
DynamicTable::prepare_query(); // Vorbereiten des WP_Query Arrays

/**
 * Filter für Marke
 */
DynamicTable::setFilterName('Marke');
DynamicTable::setFilterSlug('wpcf-marke');
DynamicTable::setFilterType('select');
DynamicTable::setFilterValues(
    DynamicTable::autoFillValues('wpcf-marke')
);
DynamicTable::createFilter();

/**
 * Filter für Bio
 */
DynamicTable::setFilterName('Bio, Nicht-Bio, Pestizidfrei');
DynamicTable::setFilterSlug('wpcf-bio');
DynamicTable::setFilterType('select');
DynamicTable::setFilterValues(
    DynamicTable::autoFillValues('wpcf-bio')
);
DynamicTable::createFilter();

/**
 * Filter für Test Pestizide
 */
DynamicTable::setFilterName('Test auf Pestizide veröffentlicht');
DynamicTable::setFilterSlug('wpcf-test-pflanzenschutzmittel');
DynamicTable::setFilterType('select');
DynamicTable::setFilterValues(array(
    '1' => 'Ja',
    '0' => 'Nein'
));
DynamicTable::createFilter();

/**
 * Filter für Test Radioaktivität
 */
DynamicTable::setFilterName('Test auf Radioaktivität veröffentlicht');
DynamicTable::setFilterSlug('wpcf-test-radioaktivitaet');
DynamicTable::setFilterType('select');
DynamicTable::setFilterValues(array(
    '1' => 'Ja',
    '0' => 'Nein'
));
DynamicTable::createFilter();

/**
 * Filter für Test Steinmühöe
 */
DynamicTable::setFilterName('Steinmühle');
DynamicTable::setFilterSlug('wpcf-steinmuehle');
DynamicTable::setFilterType('select');
DynamicTable::setFilterValues(
    DynamicTable::autoFillValues('wpcf-steinmuehle')
);
DynamicTable::createFilter();

/**
 * Filter für Cultivar
 */
DynamicTable::setFilterName('Cultivar');
DynamicTable::setFilterSlug('wpcf-cultivar');
DynamicTable::setFilterType('cultivar');
//DynamicTable::setFilterSettings(array());
DynamicTable::setFilterValues(
    DynamicTable::autoFillValues('wpcf-cultivar')
);
DynamicTable::createFilter();

//print_r(DynamicTable::getFilter());

/**
 * Dieser Befehl erzeugt das Filter-Formular. Als Wert muss die ID der Tabelle, auf welche die Filter angewendet werden sollen, übergeben werden.
 * Siehe => <table id="dynamic-test-table" ...
 */
//DynamicTable::renderFilter('dynamic-test-table');
?>

<table style="width: 100%;">
    <tbody>
    <tr style="border: none;">
        <td style="text-align: right; padding-bottom: 12px; border: none;" colspan="27" align="right">
            <p style="text-align: right;">Stand <?php echo $date; ?></p>
        </td>
    </tr>
    </tbody>
</table>
<table id="dynamic-test-table" class="tabelle-inhaltsstoffe tabelle-tee-tests tabelle-test-sencha table table-bordered footable sticky-head" style="border: none; margin-bottom: 0px;">
    <thead>
    <tr>
        <th colspan="12">
            <?php DynamicTable::renderFilter('dynamic-test-table'); ?>
        </th>
    </tr>
    <tr>
        <th style="width: 20px;" bgcolor="#fafafa" data-type="numeric" class="vertical">
            <div class="wirkung-container">
                <div class="wirkung-head" style="width: 27px !important;">
                    <div class="wirkung-vert" style="left: 5px;"><strong>Rang Test-Ergebnis</strong></div>
                </div>
            </div>
        </th>
        <th data-hide="phone,tablet"><span>&nbsp;<br>&nbsp;<br>&nbsp;</span> </th>
        <th bgcolor="#fafafa"><span><b>Matcha, <br />Marke</b></span><br />&nbsp;</th>
        <th data-hide="phone"><span><b>Preis (g)</b></span><br />&nbsp;</th>
        <th bgcolor="#fafafa" data-hide="phone,tablet"><span><b>Herkunfts-<br />Land</b></span><br />&nbsp;</th>
        <th data-hide="phone,tablet"><span><b>Steinmühle</b></span><br />&nbsp;</th>
        <th bgcolor="#fafafa" data-hide="phone"><span><b>Bio</b></span><br />&nbsp;<br />&nbsp;</th>
        <th data-hide="phone" class="vertical">
            <div class="wirkung-container">
                <div class="wirkung-head">
                    <div class="wirkung-vert"><strong>Test Pestizide veröff.</strong></div>
                </div>
            </div>
        </th>
        <th bgcolor="#fafafa" data-hide="phone" class="vertical">
            <div class="wirkung-container">
                <div class="wirkung-head">
                    <div class="wirkung-vert"><strong>Test Radioakt. veröff.</strong></div>
                </div>
            </div>
        </th>
        <th><span><strong>Preis <br />(30g)</strong></span><br />&nbsp;</th>
        <th><span><strong>Preis /<br />Leistung</strong></span><br />&nbsp;</th>
        <th bgcolor="#fafafa"><span><strong>Test-<br /> Ergebnis&nbsp;%</strong></span><br />&nbsp;</th>
    </tr>
    </thead>
    <tbody>
    <?php
    $the_query = new WP_Query(DynamicTable::getQueryConfig());

    if( $the_query->have_posts() ): ?>
        <?php
        $QCat = '';
        $QCatCurrent = $QCat;

        $i = 1;
        while ( $the_query->have_posts() ) : $the_query->the_post();
            DynamicTable::setPostId(get_the_ID());

            $QCatCurrent = trim(DynamicTable::field('wpcf-qualitaet-kategorie'));
            if( $QCatCurrent != $QCat && $QCatCurrent != null && $QCatCurrent != 'Null' && !empty($QCatCurrent)):
                $QCat = $QCatCurrent;
            ?>
            <tr class="table-subheading table-subheading-<?=sanitize_key($QCat);?>">
                <td bgcolor="#fafafa" colspan="11"><?=$QCat;?></td>
            </tr>
            <?php
            endif;
            ?>

            <tr <?php DynamicTable::rowFilter(); ?>>
                <td bgcolor="#fafafa"><strong><?php echo $i; ?>.</strong></td>
                <td class="tee-test-img">
                    <?=DynamicTable::field('wpcf-url-bild-teepackung', 'product_image')?>
                </td>
                <td id="test-teename" bgcolor="#fafafa"><strong><a href="<?php the_permalink() ?>"><?=DynamicTable::field('wpcf-teename')?>,<br /> </a><?=DynamicTable::field('wpcf-marke')?></strong></td>
                <td id="tee-test-price"><?=DynamicTable::field('wpcf-preis-original')?>€ <br />
                    (<?=DynamicTable::field('wpcf-gramm')?>g)</td>
                <td bgcolor="#fafafa"><span style="text-align: center;"><?=DynamicTable::field('wpcf-herkunftsland')?></span></td>
                <td><?=DynamicTable::field('wpcf-steinmuehle')?>.</td>
                <td bgcolor="#fafafa"><?=DynamicTable::field('wpcf-bio', 'yes_no')?></td>
                <td><?=DynamicTable::field('wpcf-test-pflanzenschutzmittel', 'yes_no')?></td>
                <td bgcolor="#fafafa"><?=DynamicTable::field('wpcf-test-radioaktivitaet', 'yes_no')?></td>
                <td><strong><?=DynamicTable::field('wpcf-preis-original')?>€</strong></td>
                <td><strong><?=DynamicTable::field('wpcf-preis-leistung')?></strong></td>
                <td id="test-tee-ergebnis" bgcolor="#fafafa"><strong><?=DynamicTable::field('wpcf-gesamtergebnis-in-prozent', 'premium')?></strong></td>
            </tr>

        <?php
        $i++;
        endwhile;
        ?>

        <?php wp_reset_postdata(); ?>

    <?php else : ?>
        <p><?php _e( 'Es sind leider keine Inhalte hinterlegt.' ); ?></p>
    <?php endif; ?>
    </tbody>
</table>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.