Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_wpc_item_featured_image( $featured_image, $params ) {
- $new_image_url = get_field( 'carousel_image', $params['post']->ID );
- if ( $params['params']['show_featured_image'] === 'true' && $new_image_url !== false) {
- $data_src = 'src="' . $new_image_url . '"';
- $image_class = null;
- if ($params['params']['lazy_load'] === 'true') {
- $data_src = 'data-src="' . $new_image_url . '" data-src-retina="' . $new_image_url . '"';
- $image_class = 'class="owl-lazy"';
- }
- $featured_image = '<div class="wp-posts-carousel-image">';
- $featured_image.= '<a href="' . $params['post_url'] . '" title="' . __('Read more', 'wp-posts-carousel') . ' ' . $params['post']->post_title . '">';
- $featured_image.= '<img alt="' . $params['post']->post_title . '" style="max-width:' . $params['params']['image_width'] . '%;max-height:' . $params['params']['image_height'] . '%" ' . $data_src . $image_class . '>';
- $featured_image.= '</a>';
- $featured_image .= '</div>';
- }
- return $featured_image;
- }
- add_filter('wpc_item_featured_image', 'my_wpc_item_featured_image', 1, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement