• Resolved cimonj

    (@cimonj)


    Howdy! I’m hoping that there’s an easy-ish way to remove the link that is attached to the images in the Flex Posts block. I’m working on some accessibility issues on my site and would prefer to have only the post title linked in in the block, rather than redundant links on both the image and title.

    Thanks for your time.

Viewing 1 replies (of 1 total)
  • Plugin Author Tajam

    (@tajam)

    Hi, please copy this code into your own plugin or your theme/child theme’s functions.php file:

    function flex_posts_thumbnail( $size, $instance = array(), $current_post = 0 ) {
    	if ( isset( $instance['show_image'] ) ) {
    		if ( 'none' === $instance['show_image'] ) {
    			return;
    		}
    		if ( 'first' === $instance['show_image'] && $current_post > 0 ) {
    			return;
    		}
    	}
    	$default_image = apply_filters( 'flex_posts_default_image', FLEX_POSTS_URL . 'public/images/default.png' );
    	?>
    	<div class="fp-media">
    		<span class="fp-thumbnail">
    			<?php if ( has_post_thumbnail() ) : ?>
    				<?php the_post_thumbnail( $size ); ?>
    			<?php else : ?>
    				<img src="<?php echo esc_url( $default_image ); ?>" class="size-<?php echo esc_attr( $size ); ?>" alt="">
    			<?php endif; ?>
    		</span>
    		<?php do_action( 'flex_posts_media', $instance ); ?>
    	</div>
    	<?php
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Remove link on image’ is closed to new replies.