Rev Slider using Neilo Feature Image

Posted on
5/5 - (350 votes)

So here was our full filter function previously that is for Rev Slider to pull the Nelio Feature image if the post doesn’t have a feature image already set. My client almost never sets a feature image and this snippet had been working for us until version 2.0.

In Rev Slider we have the background image set to external with the placeholder: %rev_neilo_featured_image_url%

/*----------------------------
//  Rev Slider using Neilo Feature Image 
-----------------------------*/
function neilo_rev_slider_insert_meta( $text, $post_id ) {
   if ( function_exists( 'get_nelio_featured_image' ) && get_nelio_featured_image( $post_id ) ) {
           $imgsrc = get_nelio_featured_image( $post_id );
	   //exit;
                
   } else if (has_post_thumbnail($post_id)) {
           $image = wp_get_attachment_image_src( get_post_thumbnail_id($post_id));
           $imgsrc = esc_url($image[0]);
   }

   return str_replace(array('%rev_neilo_featured_image_url%', '{{rev_neilo_featured_image_url}}'), $imgsrc, $text);
}
add_filter( 'rev_slider_insert_meta', 'neilo_rev_slider_insert_meta', 10, 2 );