Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här skapar du ett galleri för images i WordPress (Step-by-Step)

Vill du skapa ett image gallery i WordPress?

I ett image gallery kan du add to bilder i row och columns. This allows you to display more photos in less space while also making it easier for users to browse them.

I den här artikeln visar vi dig hur du enkelt skapar ett image gallery i WordPress som får dina images att se ännu bättre ut.

How to create an image gallery in WordPress

WordPress gör det superenkelt att add to en image till dina blogginlägg och pages. Du behöver bara add to the Imagely block och upload your image.

Men om du addar flera images till din WordPress website, kommer de att appear one after another. Det ser inte så bra ut och dina användare måste rulla mycket för att kunna view alltihop.

Images added with the Image block

Genom att skapa ett gallery allow du att visa images i en grid layout med columns och rows. You kan visa thumbnails för dina images och användarna kan clicka på dem för att se hela bilden.

På så sätt kan you visa fler bilder på mindre utrymme, och det kommer att se mycket mer professionellt ut.

Om du till exempel skapar en website för fotografering för att visa dina images, kan du genom att lägga till ett gallery visa ditt arbete på ett estetiskt tilltalande sätt.

Image gallery preview

Med WordPress kan du enkelt skapa ett gallery för images med hjälp av blocket Gallery i Gutenberg block editor.

Du kan också använda WordPress tillägg för gallerier för att skapa ännu bättre gallerier med fler funktioner.

Med detta sagt, låt oss se hur du enkelt kan skapa ett image gallery i WordPress.

I den här tutorialen visar vi två metoder för att skapa ett gallery, och du kan använda länkarna under för att hoppa till den metod du väljer:

Videohandledning

Subscribe to WPBeginner

Om du föredrar skriftliga instruktioner kan du fortsätta läsa.

Den här metoden är för att skapa ett image gallery med hjälp av WordPress block editor. Tänk dock på att den här funktionen är mycket grundläggande och inte erbjuder många alternativ för customomize.

Först måste du öppna ett befintligt eller nytt post/page där du vill skapa galleriet från WordPress admin sidebar.

När du är där klickar du bara på knappen ”+” högst upp till vänster på vyn. Härifrån kan du hitta och add the Gallery block till page eller post.

När du har gjort det klickar du på knappen ”Upload” för att ladda upp nya image-filer från din dator.

Om du däremot vill uppladda images från mediabiblioteket måste du istället clicka på knappen ”Media Library”.

Upload images for the gallery

Om du klickar på knappen ”Upload” kan du i allmänhet uploada ett foto från datorn i taget.

Du kan dock välja och öppna flera images genom att hålla ned Ctrl-tangenten på ditt tangentbord.

Upload images from the computer

När du har uploadat alla bilder kan du lägga till captions genom att clicka på ikonen ”Add Caption” i blockets toolbar högst upp på de enskilda bilderna.

Du kan också add alt text till images från block panelen till höger.

Add caption for the uploaded image

Om du väljer knappen ”Mediabibliotek” kan du välja flera images till your gallery all at once.

När du väljer images kan du också enter bildens alt-text, titel och caption från panelen attachment details på höger sida.

När du har lagt till alla images klickar du bara på knappen ”Create a new gallery”.

Add images for the gallery from the media library

Då kommer du till sidan ”Edit Gallery” i prompten för mediabiblioteket.

Härifrån kan du välja enskilda images och add to en caption, rubrik, description eller alt text till dem.

När du är klar klickar du helt enkelt på knappen ”Insert Gallery” längst ner till höger.

Add captions in the Edit gallery page

Det gallery med images som du har skapat kommer nu att add to WordPress editor.

Du kan också customize det ytterligare genom att välja Gallery-blocket och konfigurera dess inställningar från blockpanelen till höger.

Till exempel kan du använda slidern ”Columns” för att bestämma antalet columns och rows för dina gallerier.

You can even toggle the ”Crop Image” switch to crop thumbnails for better alignment.

Configure gallery settings in the block panel

Från alternativen ”Link to” kan du välja None om du vill att dina användare bara ska kunna viewa ditt foto. Detta alternativ inaktiverar click-funktionen för dina images.

Om du däremot väljer alternativet ”Media File” blir bilderna klickbara och bildfilen öppnas när du klickar på den. På samma sätt kommer bilagssidan att öppnas om du väljer alternativet ”Bilagssida”.

När du är nöjd med inställningarna klickar du på knappen ”Publicera” eller ”Update” högst upp för att store dina inställningar.

Slutligen kan du besöka din WordPress blogg för att se image gallery i action.

Image gallery preview

Nu har du på ett enkelt sätt skapat ett image gallery för din website. Men du kommer snart att notera att det saknar några viktiga funktioner.

Till exempel kommer dina images antingen ej att vara klickbara eller öppnas på en new page. Om du länkar dina galleries images till media file eller bilagssidan måste användarna klicka på bakåtknappen för att view the gallery igen.

Detta är ej användarvänligt och kan avskräcka användare från att utforska din website.

På samma sätt beror galleriets appearance också på det WordPress theme som du använder.

Dessutom kan du inte organisera dina gallerier i album, ämnen, taggar och mer. Ditt galleri lagras ej någonstans och om du behöver add to samma galleri igen måste du skapa det på nytt.

Om du vill add to gallerier som ser mer professionella ut ska du använda nästa metod.

Om du vill skapa ett mer funktionellt och estetiskt tilltalande image gallery för din WordPress site, då är den här metoden något för dig.

Vi kommer att använda pluginet Envira Gallery eftersom det är det bästa pluginet för WordPress-bildgallerier på marknaden.

Envira Gallery allow you to easily create fully responsive, beautiful, and modern image galleries in WordPress. Det är supersnabbt och kommer med många funktioner som gillar en lightbox popup, enkel navigation av bilder, en drag and drop-byggare och professionella templates för gallerier.

Först måste du installera och aktivera plugin-programmet Envira Gallery. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett plugin för WordPress.

Efter aktivering, heada över till Envira Gallery ” Settings page från WordPress dashboard för att enter din license key.

Du kan hämta den här nyckeln från ditt account på Envira Gallerys website.

Note : Envira Gallery har också ett gratis plugin som du kan använda. Pro-versionen kommer dock att användas i denna tutorial för att utvalda funktioner ska kunna låsas upp.

Add the Envira Gallery license key

När du har kontrollerat din license key kan du heada över till Envira Gallery ” Add New page från sidebaren i WordPress för att börja skapa ditt första galleri.

När du är där, ange en Rubrik för ditt gallery och klicka sedan på knappen ”Select files from computer” för att uploada dina images.

Creating a New Gallery with Envira Gallery WordPress Plugin

Du kan också uploada images från ditt mediabibliotek i WordPress genom att clicka på knappen ”Select files from other sources”.

Tänk på att om du använder det här alternativet kan du bara uploada en enda image åt gången från mediabiblioteket.

När du har uploadat bilderna rullar du ner till ”Gallery” section, där alla dina images nu kommer att visas.

Images in Envira Gallery Builder

Därefter kan du clicka på pencil iconen högst upp på varje image för att öppna ”Edit Metadata” på vyn.

Härifrån kan du add to caption, status, rubrik och alternativ text för enskilda images.

När du är klar, glöm inte att klicka på knappen ”Save Metadata” för att save your image captions.

Edit Gallery Image Metadata

Därefter måste du klicka på tabben ”Configuration” från sidebaren till vänster.

Härifrån kan du ändra layouten för ditt gallery, inklusive antalet columns, lazy loading av bilder, bildstorlek, positionering av titel och caption, marginaler, höjder, thumbnail-storlekar, bilddimensioner med mera.

Edit gallery configuration settings

Därefter byter du till fliken ”Lightbox” från vänster sidebar och kontrollerar alternativet ”Aktivera Lightbox”.

Detta alternativ gör det möjligt för användare att förstora images och browsing dem utan att lämna page.

Du kan låta de andra standardinställningarna vara som de är eftersom de fungerar mycket bra för de flesta webbplatser, men du kan reviewer alternativen och ändra dem om du gillar.

Enable the lightbox

Klicka sedan på tabben ”Mobile” för att konfigurera dina inställningar för gallery för mobila enheter.

Härifrån kan du välja bilddimensioner för mobila enheter, aktivera eller inaktivera Lightbox, aktivera eller inaktivera captions till bilder med mera.

Configure settings for gallery

Efter det kan du granska fler alternativ som gillar gallery slug och lägga till custom CSS från avsnittet ”Misc”.

När du är nöjd med dina Settings klickar du bara på knappen ”Publicera” högst upp för att store dina ändringar.

Miscellaneous gallery settings

Därefter måste du öppna ett post eller en page där du vill embedda your gallery.

När du är där klickar du på knappen ”+” högst upp till vänster på vyn för att öppna block-menyn.

Därefter letar du bara upp och addar blocket Envira Gallery till sidan eller posten.

Add the Envira gallery block

När du har gjort det måste du lägga till ditt image gallery från dropdown-menyn i Envira Gallery-blocket.

Slutligen klickar du på knappen ”Update” eller ”Publicera” högst upp för att save your changes.

Nu kan du viewa ditt image gallery på din WordPress website.

WordPress Photo Gallery Created with Envira Gallery

Here, you will notice that clicking on any image in the gallery will open it in full size with the lightbox effect.

You can also browse images in this popup by pressing the left and right arrow keys on the screen or your keyboard.

Envira Gallery Image in the Lightbox Popup

Bonus: Optimera galleries images för search engines

Det är viktigt att optimera alla dina galleries images utan att förlora webbkvalitet så att search engines kan indexera dem för rätt keywords.

Detta kan bidra till att öka hastigheten för att hämta din page, förbättra användarupplevelsen, öka delningar i sociala media och ge organisk trafik till din website.

Du kan enkelt optimera dina images i galleriet genom att lägga till alt-text på bilagssidan. Denna description visas för search engine crawlers och hjälper dina gallerier med images att ranka högre.

Add alt text with all your images

Dessutom kan du också använda All in One SEO, som är det bästa WordPress SEO plugin på marknaden.

Den levereras med en Image SEO addon som automatiskt ställer in din alt-text, bildtitlar, captions och mer. Det kommer också att add to en korrekt image sitemap och andra SEO funktioner för att förbättra din SEO ranking.

För mer information, se vår AIOSEO review.

All in One SEO website

Utöver det bör du också använda beskrivande filnamn för dina images, använda relevanta keywords och dela dina gallerier på social media. För fler tips, se vår guide för nybörjare om hur man optimerar images för search engines.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du skapar ett bildgalleri i WordPress. Du kanske också vill se vår jämförelse mellan WebP vs. PNG vs. JPEG: det bästa bildformatet för WordPress och våra expertval av de bästa WordPress-pluginsen för att hantera bilder.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

147 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Chris says

    I just started using standard wordpress image galleries. When I add images to the gallery, if I do not have enough images to fill an entire row, the last row’s image is displayed at a size that allows the image to fill the full width of the container. So the default of 3 images per row applies until the row runs out of images, then I get a final row with a giant image. Is there a way to force every image to the same size so that the gallery just has all images the same size, regardless of whether the row it appears in is full?

    • WPBeginner Support says

      For that, you would want all of your images uploaded to be the same size and then you would uncheck the crop images checkbox that forces your images to align.

      Administratör

  3. Roger Novak says

    Can separate clickable links be attached/embedded to each picture in a gallery that will take the viewer to another web site?

    • WPBeginner Support says

      It is a page that specifically shows your media item with your theme’s styling to include the header and footer of your site.

      Administratör

  4. To the Aisle Australia says

    Hi! Great info here – we are still having no luck centreing our gallery – despite clicking centre in both wordpress and elementor post editor… any suggestions would be greatly appreciated!

    • WPBeginner Support says

      If you are using Elementor and the settings are being ignored, you would want to reach out to Elementor’s support and they would be able to assist.

      Administratör

  5. Matthew Busse says

    I found this very difficult to follow, my WordPress is set up very different. The date at the top says Jan 2020, but there are comments from 2016? When was this created? Since the date at the top said January 2020 *(and it’s now June 2020), I thought this would still represent the current WordPress, but it doesn’t. So this is just very confusing…

    • WPBeginner Support says

      This guide was updated for it to work with the block editor. If your admin area looks different, you may be using WordPress.com.

      Administratör

  6. Nilla says

    Great tutorial. However, you don’t advise worpress.com users that you need to be on a Business Plan to install plugins, which is extremely annoying.

  7. Brent says

    Hello, thank you for the post. I have a gallery I built in Elementor. How can I allow my client access to upload and delete photos from the gallery page?

    • WPBeginner Support says

      You would want to reach out to Elementor’s support with what you are wanting to do for them to be able to assist you.

      Administratör

  8. Tegah says

    Please How can i create featured image gallery in new wordpress.

    i.e i what my featured image post to be made up of multiple images like a gallery

    • WPBeginner Support says

      If your theme does not offer that ability by default, you would need to use a plugin like the one we recommend in this article :)

      Administratör

  9. Stacey Barrett says

    Is there an easy way to make all photos in the gallery the same size so it looks uniform? I’m creating the gallery for a non-profit newsletter.

    Thank you, stacey

    • WPBeginner Support says

      With the default gallery as long as you enabled the crop images they should be uniform in size.

      Administratör

  10. Jaco says

    Hi I understood all that and thank you very much. so can you give me an idea how I can make a gallery appear by clicking on a photo.?
    I want when some one click on a photo and then the gallery will appear.
    with worpress
    Help me please

    • WPBeginner Support says

      For what it sounds like you’re wanting, you may want to take a look at Envira Gallery and the album feature

      Administratör

  11. Robert says

    Thanks for putting this amazing piece of content together! I ended up using the a gallery plugin because it was super easy to set up :)

  12. Wendy says

    Hi, I have been managing a gallery on my site for years, but am only realizing now that it seems as though WP will only allow me to share 100 photos at a time. Is there a way to display more? I have a Premium plan.
    Thanks!

  13. Alison says

    Thank you for this helpful article. I make galleries all the time on my desktop computer, but I am hoping to blog from the trail this summer while backpacking the Colorado Trail and will be using my phone to do so. Is there any way to create galleries using the WordPress mobile app? I have been experimenting with that and can’t seem to figure out how to do so.
    Thank you!

  14. Dave Maynard says

    I’m using th wordpress gallery creator. When I create a gallery with 3 columns in 2 rows of pictures, it looks good. But when I click on Preview, it shows me what my webpage will look like but it has the pictures all on top of one another and not in the 3 columns & 2 rows like I wanted.
    How can I repair this?

  15. Craig Langburne says

    How can I display a single image and link it to a slide show in a new window?
    – I don’t want 12 thumbnails on the page – just one image the says ’See the gallery’

  16. Steven says

    Yes!! Great tutorial! This saves me from having to revert to site origin builder when I have already used the reular wordpress editor. Works really well. I wish I would have realized this a long time ago but never reseached it. Thanks for this info.

    Steven

  17. Kyle says

    Can I great a photo gallery that automatically transitions between 5-10 images automatically once my page has been loaded? I was also hoping to embed this on my homepage. Any help would be great. Thanks.

  18. Erin says

    Hi!

    I am trying to add an image gallery that has links to various external pages (i.e. you click on an image and it brings you to that website.) I have determined that this is difficult to do with the WP gallery because they want all the images to go to the same linked page, but I want each of my images to go to a different page. It seems envira is not free. I downloaded gridplus and gridable but am still struggling with how to do this. ideas??

  19. Sarah says

    Hi there! I’m trying to figure out my gallery in WordPress, but when I publish it shows in one single column, but the backend looks normal and how I want. Do you know how to fix this?

  20. Robin Pacific says

    HI — I’m trying to update my site and have created a new gallery, but I can’t figure out if I did it in WP or NextGen. I can’t see how to insert it into the project.
    I have inserted a video successfully. Can I have a video (on Vimeo) and also a gallery?

    thanks,
    Robin

  21. loretta says

    great tutorial thanks!
    My blogs show as individual thimble images on the front blog page. If you hover over image you see the title. My issue is when you click on my blog page it looks like I have nil blogs as it takes up to 20 seconds for all images to show. Can you have the blogs list as titles rather images? If i hide featured image the boxed appear blank which is worse.
    Many Thanks
    Loretta

  22. Ali says

    I have a website I want to add gallery to my website.. This gallery will hold GBs of data more than 100GB. Is there any limitation in wordpress for that?

  23. Vicki Bentley says

    If I create a gallery, can I then add more photos to the same gallery and somehow update the gallery post page? (I’m posting recipes of food dishes, and as I complete more of them, will want to update the post.)

  24. Vicki Bentley says

    If I create a gallery using the default WP functionality, but decide later that I’d like to upgrade to more functionality with something you’ve mentioned, can I simply add the plug-in and have it all convert, or will I have to rebuild the gallery from scratch?

  25. Howard Mkongo says

    Loved the tutorial. Was a stepping stone to creating a custom plugin. After a few tweaks…problem solved

  26. Sayan Das says

    Thank you Wpbeginner,
    I am a regular visitor of your site for my new blog.
    Whenever I facing any problem for my new blog, I directly open your blog.
    Thanks again and keep sharing.

  27. Komal Kim Kevin says

    You guys are the bomb! Thank you so much for this easy ”WP for Dummies” sort of post! Keep it up!!!

  28. Sandy Little says

    I have been playing with an image gallery. Once I make the gallery, can I somehow make each image clickable in order to direct people to my posts?

    • Anita says

      Thanks! I look forward to trying out this plugin.

      Can you recommend a plugin that will let me create a gallery of featured images from my posts, by post category? I want users to be able to click the image to view the related post. Thanks!

  29. Tamara Groom says

    Your plugin is a life-saver. I am unable to connect to Jetpack because of a issue with the client’s host and the other lightbox plugins I tried weren’t great. WPBeginner always has an answer, thanks for all you do!

  30. Martha says

    The gallery seems to default to three images across in my posts, is there any way I could have 4 or 5 images running across in each line?

  31. William Fitch says

    Thanks for an on-the-button explanation of the gallery. I must’ve tried a dozen other posts, which were all over the place, before I found this one.

    I have a question. Is it possible to bunch the images in a gallery closer together. I’ve tried all sorts and my images remain far apart

  32. Avinesh Shakya says

    How can i display the the images of the gallery along with caption.

    I want caption of each image in gallery to be stored in variable

  33. Jacques says

    Why are there no spaces between the images on my page and in the beginning of your tutorial you mention a lightbox but you never get to explaining how to make it as you only cover the carousel part.

    Where can I find this and how can I get the spaced grid option??

  34. Gennie says

    So does things like social media activity now count for SEO?
    I was told they help because of the Panda Google algorithm refresh
    Added to Digg, someone will like it

  35. Arabella says

    How do you delete images from a gallery? I have tried every single thing I can possibly think of and followed all the advice given on the internet, but the images are still there on my home page, even though I have deleted them multiple times from the actual gallery. There are no problems with the Media Library, just the gallery that appears on my home page. If anyone can tell me how to get rid of these pictures, that would be greatly appreciated.

  36. Craig Swank says

    I have created several image galleries which are initially uploaded in alphabetical order – I need to add large groups of additional images from time to time (this is in Word Press dot Com) – Is there anyway to re-alphabetize the entire gallery without being required to ”drag and drop” – When adding 100’s of new images that is not an option.

    Thanks

  37. John Byrne Barry says

    I just discovered this after trying some plug-ins, but the problem I’m trying to address is the same, with this and with the various plugins. Which is how to add a link to the image, so when you click on the image, it takes you to a specific page. Not the media file. Any suggestions? Thanks.

  38. Freddie says

    I feel really stupid but just created a gallery page….updated with photos and text….simple enough. Why does ”image gallery”, ”slide show” and all this other stuff show up at the bottom of the page? I cannot figure out how to delete it. newby at web design.

  39. Mauricio says

    Absolutely well explained, it’s so helpful, I love it. Thank you so much for this video, great work.

  40. melanie bund says

    HI, Would be helpful to alot of people if you also suggested a free gallery plugin, rather than advertise a paid plugin
    Melanie

    • Collin says

      You should have kept reading. They do offer a pretty cool free plugin to add to the existing WP gallery. A nice looking carousel. Did you see?

  41. Miguel Garcia says

    Thank you very much for the tutorial.

    I have just one question.

    I created the gallery and published it, but when i put the mouse over the picture, it show a red square with two small silver squares that says: ”view attachment page’ and ”view in full size”

    How can i remove it? I wanna make it like in facebook, that you just put the mouse over, click and see the carousel.

    Is that possible?

  42. Jeff Brown says

    I did what you suggest above to create a simple gallery on a webpage. It shows up beautifully. However whenever I click on one of the thumb nail images it says : ”image cannot be loaded. Make sure path is correct and image exist”.

    • Jeff Brown says

      Just to clarify, I mean when I click on ANY of the thumbnails in that gallery I get that same error message.

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.