Home › Forums › Pro Support › List item order / image swap on hover › Reply To: List item order / image swap on hover
January 17, 2019 at 6:21 pm
#7225
Keymaster
We would still need to know which image to use from the Media Library.
For example, if it was a URL in a custom field, we could do this:
add_action( 'wpsp_inside_image_container', function( $settings ) {
if ( 123 === $settings['list_id'] ) {
$image = get_post_meta( get_the_ID(), 'your_custom_field', true );
if ( $image ) {
echo '<img src="' . $image . '" class="secondary-image" />';
}
}
} );
Then we could use this CSS:
.wp-show-posts-image .secondary-image,
.wp-show-posts-image:hover img:not(.secondary-image) {
display: none;
}
.wp-show-posts-image:hover .secondary-image {
display: block;
}
However, I’m not sure how well that would work, as the hook is before the image link, unfortunately.
Ah yes, there isn’t an option for the title color on hover, so if the backgrounds are super different, you’ll need to use CSS to change them.