[Resolved] Showing thumbnails only on mobile

Home Forums Support [Resolved] Showing thumbnails only on mobile

Home Forums Support Showing thumbnails only on mobile

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1328287
    Elio Martinez

    Hi,

    A question about image sizes and how to optimize loading times.

    In Blog > Archive is there a way to show thumbnails on mobile and medium on tablet and computers?

    Thanks.

    #1328402
    David
    Staff
    Customer Support

    Hi there,

    hmmm…. you could try using this filter:

    https://docs.generatepress.com/article/adjusting-the-featured-images/#changing-the-featured-image-sizes-using-a-filter

    and change the condtion from:

    if ( is_post_type_archive( 'portfolio' ) ) {

    to

    if ( wp_is_mobile() ) {

    More info on the wp_is_mobile function:

    https://developer.wordpress.org/reference/functions/wp_is_mobile/

    #1328406
    Elio Martinez

    Hi David,

    If I use that function the only thing that changes is the size, but not the file. What I want is to show the thumbnail file in mobile (lighter than medium) and the medium file in tablet and desktop.

    #1328417
    David
    Staff
    Customer Support

    I am not 100% sure but … if you set the sizes using that function and there is a Media Attachment available that matches it then WP may grab that file.

    Haven’t tested it though.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.