Change banner image in blogs to featured images

By default in blog posts, you should set featured images and banner images. But if you want to use the featured image as a banner background you can simply make the following changes.

Activate the Child Youplay theme and copy a single.php file to it from the parent theme. Then you can make customizations in this file.

Open single.php and find this line:

echo do_shortcode('[yp_banner img_src="' . yp_opts('single_post_banner_image', true) . '" img_size="1400x600" banner_size="' . yp_opts('single_post_banner_size', true) . '" parallax="' . yp_opts('single_post_banner_parallax', true) . '" top_position="true"]' . ($banner_cont?wp_kses_post($banner_cont):'<h1 class="h2">' . get_the_title() . '</h1>') . '[/yp_banner]')

Change it to this one:

echo do_shortcode('[yp_banner img_src="' . get_post_thumbnail_id() . '" img_size="1400x600" banner_size="' . yp_opts('single_post_banner_size', true) . '" parallax="' . yp_opts('single_post_banner_parallax', true) . '" top_position="true"]' . ($banner_cont?wp_kses_post($banner_cont):'<h1 class="h2">' . get_the_title() . '</h1>') . '[/yp_banner]')
Was this page helpful?