Skip to content

Show keywords for an image

When you include keywords within the metadata of an image (using Lightroom, Adobe Bridge, or your favorite image manager software), they are saved and searchable by default in Sunshine Photo Cart. In the below code example, you can also show all the keywords on the single image view. You can also show all the EXIF metadata.

add_action( 'sunshine_after_image', 'sunshine_show_image_keywords' );
function sunshine_show_image_keywords( $image ) {
	$metadata = $image->get_meta_value( '_wp_attachment_metadata' );
	if ( ! empty( $metadata['image_meta']['keywords'] ) ) {
		echo join( ', ', $metadata['image_meta']['keywords'] );
	}
}

Learn how to add this custom code to your WordPress website

Still need help?

If you have not yet found your answer in the documentation articles, please contact support