You were not that far! You were just missing a simple conditional statement inside that foreach
loop. Something like if ( $data['key'] !== 'Kcalperdag' ):
should do the trick.
I've tested it with a bogus array
and it seems perfect.
We use the $data['key']
as a condition to chose if we want to display or not our content.
<dl class="variation">
<?php
foreach ( $item_data as $data ):
if ( $data['key'] !== 'Kcalperdag' ): ?>
<dt class="<?php echo sanitize_html_class( 'variation-' . $data['key'] ); ?>">
<?php echo wp_kses_post( $data['key'] ); ?>:
</dt>
<dd class="<?php echo sanitize_html_class( 'variation-' . $data['key'] ); ?>">
<?php echo wp_kses_post( wpautop( $data['display'] ) ); ?>
</dd>
<?php endif;
endforeach; ?>
</dl>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…