function wpogp_image_url() { global $post; $image = get_the_post_thumbnail_src(get_the_post_thumbnail($post->ID)); if (empty($image)) { return wpogp_image_url_default(); } else { return $image; } }
<?php if (have_posts()) { while (have_posts()) { the_post(); ?> <h1><?php the_title(); ?> </h1> <section> <div class="row our-hotel"> <div class="col-sm-6 col-lg-5 height-fix-to bckg-norepeat"<?php if (has_post_thumbnail()) { ?> style="background-image:url(<?php echo get_the_post_thumbnail_src(get_the_post_thumbnail($post_id, 'large')); ?> )" <?php } ?> ></div> <div class="col-sm-6 col-lg-offset-1 height-fix-from"> <div class="container-half"> <?php if (get_field('about_granit_after_img')) { echo do_shortcode(get_field('about_granit_after_img')); } ?> </div> </div>
function the_post_thumbnail_src($size = 'thumbnail') { echo get_the_post_thumbnail_src($size); }