We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support filter to alter output Reply To: filter to alter output


Hi Tom!

Thanks very much for your quick answer.
Well, I’ve used this code in the archive pages which check if an image file is loaded and if is so, uses it as the thumbnail img:

function etdla_custom_featured_image( $output ) {
	if ( get_post_meta( get_the_ID(), 'imatge_destacada_alternativa', true ) ) {
		$foto_alt_id = get_post_meta( get_the_ID(), 'imatge_destacada_alternativa', true ) ;
		$foto_alt_url = wp_get_attachment_url( $foto_alt_id );
		$image_alt = get_post_meta($foto_alt_id, '_wp_attachment_image_alt', TRUE);
		return '<div class="post-image">
			<a href="'. get_the_permalink( get_the_ID() ) .'">
			<img width="300" height="190" src="'.$foto_alt_url.'" class="attachment-300x190x1 size-300x190x1 wp-post-image" alt="'.$image_alt.'" itemprop="image" />
  } else {
     return $output;
add_filter( 'generate_featured_image_output', 'etdla_custom_featured_image');