Site logo

Archived topic

Change image when viewed on a mobile

6 replies · Started by Peter on July 13, 2022

Viewing posts 1–7 of 7

Hi

I've created a hook to display an image before the footer as a space for an advert.
It's very narrow and I would like to change the image when the page is viewed on a mobile and tablet.
I've had a good look through previous posts and can't seem to find a solution.
Any help would be gratefully received.

Cheers

Pete

Hi there,

can i see the site with the hooked in image?

OK, so you would need to add 2 x Images in your Hooks. One for Mobile and one for Desktop.
Then select the relevant Image Block and in Advanced > Additional CSS CLass(es) you can add the relevant GP hide-on-* image classes

https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes

e.g for the Desktop / Tablet image add: hide-on-mobile
for the Mobile image add: hide-on-desktop hide-on-tablet

Great stuff - will give that a crack. Thanks

Worked a treat. Thanks again.

Glad to be of help!

This archived topic is closed to new replies.