Last active
February 5, 2016 09:20
-
-
Save CotswoldPhoto/ffffeae2768274a81b20 to your computer and use it in GitHub Desktop.
Modify WP Posts Carousel plugin to remove link from Featured Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_wpc_disable_featured_image_link( $featured_image, $params ) { | |
if ( $params['params']['show_featured_image'] === 'true' ) { | |
$data_src = 'src="' . $params['image'] . '"'; | |
$image_class = null; | |
if ($params['params']['lazy_load'] === 'true') { | |
$data_src = 'data-src="' . $params['image'] . '" data-src-retina="' . $params['image']. '"'; | |
$image_class = 'class="owl-lazy"'; | |
} | |
$featured_image = '<div class="wp-posts-carousel-image">'; | |
$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.= '</div>'; | |
} | |
} | |
add_filter('wpc_item_featured_image', 'my_wpc_disable_featured_image_link', 1, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try this