WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Gallery: Display the first image/thumbnail of a gallery only (4 posts)

  1. phr4pp
    Member
    Posted 8 months ago #

    I'm looking for a seemingly simple solution to display only the first image/thumbnail of a WordPress gallery. The problem:

    I'm using the WordPress Gallery (with the Jetpack jCarousel) for my galleries. Everything is working fine. But I've got one problem:

    I would like the WordPress Gallery to show only the first or only one image of a gallery instead of all. I've been searching for quite a long time but didn't find a solution yet. It should be quite a simple code (I can't programm) to do just that.

    Does anyone have a solution for that?
    Simply display only the first image/thumbnail of the gallery - when you click on it the gallery shall still open with all images as usual.

    Thanks in advance!

  2. phr4pp
    Member
    Posted 8 months ago #

    Another solution/code that would help me is to specify the number of images/thumbnails the gallery shows.

  3. phr4pp
    Member
    Posted 8 months ago #

    I have found a solution with CSS. Not perfect, but it works:

    .gallery-item {
    display:none;
    }
    
    .gallery .gallery-item:first-child {
      display:block !important;
    }

    Hide all gallery images and only display the first image.

  4. Jason
    Member
    Posted 2 months ago #

    This appears to work well if you're using the built-in WP Gallery (as you mention above). Just tried it out and works great! Thanks!

Reply

You must log in to post.

About this Topic