If thumbnail image else post title

I’am new to coding and after 5+ hours of trying i have to seek help.

I have a table with results on my website and I want to display post title when featured image is missing and to don’t show button when exlink is missing.

img class=”logo” – is the featured image that needs to else title

a class=”exlink” – is the link that needs to else dont display button (almost all the way down)

This is copypasted from page template:

<?php
query_posts(array(
‘post_type’ => ‘mms’,
‘showposts’ => -1,
‘meta_key’ => ‘kr’,
‘orderby’=>’meta_value_num’,
‘order’=>’ASC’
) );
?>

<?php while (have_posts()) : the_post();
// $image1 = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array(100, 100) );
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ );
?>
<div class=”mainrecord”>

<div class=”col-lg-4 col-sm-4 col-md-4 col-xs-12 logoimage” >
<img class=”logo” src=”<?php echo $image[0]; ?>”/>
<h5 class=”wifi”><img src=”<?php echo get_template_directory_uri().’/images/wifi-signal-tower(1).png’;?>” alt=”img”/> <?php the_field(‘network’); ?></h5>
</div>
<div class=”col-lg-4 col-sm-4 col-md-4 col-xs-12 services new”>
<h4 class=”ctitle”>
<?php

// $values = get_field(‘select_service’);

$values = get_field(‘select_service’);
$field = get_field_object(‘select_service’);
$choices = $field[‘choices’];
?>

$label) {
?>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

” alt=”img”/>

</h4>
<p class=”thgb”><?php the_field(‘set_mb’); ?><br>GB</p>
</div>
<!–<div class=”col-lg-2 col-sm-2 col-md-2 col-xs-12 mb”>
<p><?php// the_field(‘set_mb’); ?> <br/>GB</p>
</div>–>
<!– <div class=”col-lg-2 col-sm-2 col-md-2 col-xs-12 selectany”>
<p><?php //the_field(‘select_any’); ?></p>
</div>–>
<div class=”col-lg-4 col-sm-4 col-md-4 col-xs-12 prices”>
<div class=”priceinner”>
<?php $old = get_field( “mandespris” );
if( $old ) {
?>
<p class=”pricw”><span class=”newprice”>kr <?php the_field(‘kr’); ?>,</span>-<br/><span class=”oldprice”><del>kr <?php the_field(‘mandespris’); ?></del>,</span>-<br/>Pris/måned</p>
<?php } else { ?>
<p class=”pricw”>kr <?php the_field(‘kr’); ?>,-<br/>Pris/måned</p>
<?php } ?>

<p class=”nomonth”>
<a class=”exlink” href=”<?php the_field(‘link’); ?>” target=”_blank”>Les mer </a>
<?php $value = get_field( “no_of_month” );
if( $value ) {
?>
<span class=””>* <?php the_field(‘no_of_month’); ?> Måneder</span>
<?php } ?>
</p>
</div>
</div>
<div class=”accordion_head”><span class=”plusminus”>+</span>Mer Informasjon</div>
<div class=”accordion_body”>
<!–<p>First Accordian Body, it will have description</p>–>
<div class=”col-lg-12 col-sm-12 col-md-12 col-xs-12″>
<div class=”rowcontent”>
<p><?php the_field(‘row1’); ?></p>
</div>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>

Read more here:: If thumbnail image else post title

Leave a Reply

Your email address will not be published. Required fields are marked *