Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support List item order / image swap on hover Reply To: List item order / image swap on hover

#7225
Tom
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.