wrapping post_ thumbnail post_title and get_post_meta in href
-
So this is what I have so far:
<div class="bxslider-img"> <?php // Check if there's a Slide URL given and if so let's a link to it if ( get_post_meta( get_the_id(), 'hpa_slideurl', true) != '' ) { ?> <a href="<?php echo esc_url( get_post_meta( get_the_id(), 'hpa_slideurl', true) ); ?>"> <?php } // The Slide's Image echo the_post_thumbnail('slider-img'); // Close off the Slide's Link if there is one if ( get_post_meta( get_the_id(), 'hpa_slideurl', true) != '' ) { ?> </a> <?php } ?> <div class="bxslider-text"> <?php echo the_title(); echo get_post_meta( get_the_id(), 'hpa_slidedescription', true); ?> </div> </div>
What I would like to have but I get an error,
<div class=”bxslider-img”><?php // Check if there’s a Slide URL given and if so let’s a link to it
if ( get_post_meta( get_the_id(), ‘hpa_slideurl’, true) != ” ) { ?>
“>
<?php }// The Slide’s Image
echo the_post_thumbnail(‘slider-img’);
<div class=”bxslider-text”>
echo the_title();
echo get_post_meta( get_the_id(), ‘hpa_slidedescription’, true);
</div>// Close off the Slide’s Link if there is one
if ( get_post_meta( get_the_id(), ‘hpa_slideurl’, true) != ” ) { ?><?php } ?>
</div>
- The topic ‘wrapping post_ thumbnail post_title and get_post_meta in href’ is closed to new replies.