Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
p.couret

Add link on featured image

Hi,
I would like to know how could i display the full image when clicking on the featured image thumb column please ?
adding a href to the image in a blank window ?
thanks

4 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

Hi,

You can use the following snippet to make the image clickable.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC\Column
 */
function ac_make_feature_image_columns_clickable( $value, $id, $column ) {
	if ( $column instanceof AC\Column\Post\FeaturedImage && $thumbnailid = $column->get_raw_value( $id ) ) {
		$value = sprintf( '<a href="%s" target="_blank">%s</a>', wp_get_attachment_url( $thumbnailid ), $value );
	}
	return $value;
}
add_filter( 'ac/column/value', 'ac_make_feature_image_columns_clickable', 10, 3 );
4 years, 11 months ago
p.couret

Hi Stefan,
It works great , thanks a lot !

4 years, 11 months ago

You must be logged in to reply to this topic.