Skip to content

Instantly share code, notes, and snippets.

@MrThiemann
Created August 14, 2020 13:06
Show Gist options
  • Save MrThiemann/3b80930ed623d291d18d81b1cfa1b53e to your computer and use it in GitHub Desktop.
Save MrThiemann/3b80930ed623d291d18d81b1cfa1b53e to your computer and use it in GitHub Desktop.
vergleich-tabelle
<?php
$args = array(
'post_type' => '3d_drucker',
'posts_per_page' => '10',
//'orderby' => 'Platzierung',
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => 'platzierung',
'meta_value' => '10',
'meta_compare' => '>'
);
$Vergleichstabelle = new WP_Query($args);
if($Vergleichstabelle->have_posts()) {
?>
<table>
<thead>
<tr>
<th>Platzierung</th>
<th>3D Drucker</th>
<th>Listenpreis</th>
<th>Aktionspreis</th>
<th>Aktion / Gutschein</th>
<th>Zum Angebot</th>
<th>Infos zum Gerät</th>
</tr>
</thead>
<tbody>
<?php
while ($Vergleichstabelle->have_posts()) {
$Vergleichstabelle->the_post();
// Wenn mindestens 1 Datensatz vorhanden ist
// Platzierung aus Feld laden
$platzierung = get_field( 'platzierung' );
// 3D Drucker aus Feld laden
// $bezeichnung = get_field( 'bezeichnung' );
$bezeichnung = get_field( 'modell' );
// Listenpreis aus Feld laden
$listenpreis = get_field( 'listenpreis' );
// Aktionspreis aus Feld laden
$aktionspreis = get_field( 'aktionspreis' );
// Gutschein aus Feld laden
$gutschein = get_field( 'gutscheincode_gearbest' );
// Angebot aus Feld laden
$angebot = get_field( 'angebot' );
// Info aus Feld laden
$info = get_field( 'info' );
$gearbestlink = get_field('gearbestlink');
echo "<tr>";
echo "<td>$platzierung</td>";
echo "<td>$bezeichnung</td>";
echo "<td>$listenpreis </td>";
echo "<td>$aktionspreis </td>";
echo "<td>$gutschein</td>";
//echo "<td>$angebot</td>";
echo '<td><a href="'. $gearbestlink.'">Zum Angebot</a></td>';
//echo '<td><<a href="'. $gearbestlink.'"Zum Angebot</a>';
echo '<td><a href="'. get_the_permalink().'">'. get_the_title().'</a>
</p></td>';
echo "</tr>";
}
?>
</tbody>
</table>
<?php
} // end if have posts
@MrThiemann
Copy link
Author

<?php $args = array( 'post_type' => '3d_drucker', 'posts_per_page' => '10', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => 'platzierung', 'meta_query' => array( array( 'key' => 'platzierung', 'value' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 'compare' => '>', ), ), ?>

https://ibb.co/PgcRddJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment