Skip to content

Instantly share code, notes, and snippets.

@MrThiemann
Last active August 13, 2020 04:15
Show Gist options
  • Save MrThiemann/de125a0ef1fdd3a85c433dacdfdb8fad to your computer and use it in GitHub Desktop.
Save MrThiemann/de125a0ef1fdd3a85c433dacdfdb8fad to your computer and use it in GitHub Desktop.
test_angebote.php
<?php
<div class="one_field">
<div class="active-goods-item ">
<div class="tab_content active ">
<ul class="produ-list clearfix js-brandsItem moregoods_color ">
<li class="googleTempTwo subjectGoodItem">
<div class="pro-content">
<div class="goods-img pr">
<?php $angebot_1 = get_field( 'angebot_1' );
if ( $angebot_1 ) {
// $post = $angebot_1;
$image = get_field( 'image' );
$size = 'full'; // (thumbnail, medium, large, full or custom size)
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'large');
if ( $image ) {
// echo '<pre>'; var_dump( $image ); echo '</pre>';
echo '
<img
width="300"
height="300"
src="' . esc_url( $image['url'] ) .'"
alt="' . esc_attr( $image['alt'] ) . '"
class="img-responsive product-img wp-post-image box_image" /> ';
$lager = get_field ('lager');
if ( $lager) {
echo '<span
class="goods_label"
style="background-color: #00CC99;color: #ffffff;bottom:8px;border-color: #00CC99;">
<span>Versand aus Deutschland</span>
</span> ';
}
}
else {
echo '<img
width="300"
height="300"
src="/wp-content/uploads/2019/09/cropped-Logo_512x512-4.png"
alt="'. esc_attr( $image['alt'] ).'" /> ';
echo' <span
class="goods_label" style="background-color: red;color: #ffffff;bottom:8px;">
<span>Leider kein Bild vorhanden</span>
</span> ';
}
wp_reset_postdata();
}
?>
</div>
</div>
</li>
</ul>
</div>
<?php $angebot_1 = get_field( 'angebot_1' );
if ( $angebot_1 ) {
$post = $angebot_1;
$listenpreis = get_field(listenpreis);
$aktionspreis = get_field(aktionspreis);
$gearbestlink = get_field(gearbestlink);
$gutscheincode_gearbest = get_field(gutscheincode_gearbest);
setup_postdata( $post );
echo '<p class="goods-title">
<a href="'. get_the_permalink().'">'. get_the_title().'</a>
</p> ';
echo '<p class="">
Gutscheincode: '. $gutscheincode_gearbest.'
</p> ';
echo '<p class="goodOrinalPrice"
style="text-decoration: line-through; display: inline-block; vertical-align: middle;">
'.$listenpreis.'
</p> ';
echo '<p class="goodOrinalPrice">
<p class="price_original">
<a href="'. $gearbestlink.'"
class="gearrbestlink"
target="_blank"> '. $aktionspreis.'
</a>
</p>
</p>';
echo '<p class="goods-buy showCart ">
<a href="'. $gearbestlink.'">
</a>
</p>';
wp_reset_postdata();
}
?>
</div>
</div>
?>
@MrThiemann
Copy link
Author

Fieldtyp: Image --> Image-Array
https://ibb.co/s1B7Pgh

Fieldtyp: single line text --> for URL
https://ibb.co/GcsfMgf

Display Meta-Box
https://ibb.co/QfVv9dn

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