Skip to main content

Questions tagged [gallery]

Build in WordPress gallery. Used to show multiple pictures in a grid.

Filter by
Sorted by
Tagged with
1 vote
1 answer
689 views

How to change the output of gallery shortcode

I would like to add the media description as a data-attribute to each image of the gallery. All the other answers favour the solution to copy the whole code from media.php to functions.php and change ...
0 votes
1 answer
2k views

How to insert fancybox to multiple separate galleries in a post?

Okay I'm trying to add fancybox functionality to the galleries in posts. I found this stack exchange: How do i add class="fancybox" to the default gallery? and I managed to get the basic ...
0 votes
0 answers
10 views

Unable to Edit or Add Photo Gallery Under Portfolio in WordPress 6.2.5

I'm experiencing an issue with editing or adding a photo gallery for our projects under the Portfolio section in WordPress 6.2.5. Details: WordPress Version: 6.2.5 Plugin Version: 1.8.58 (lightbox ...
0 votes
2 answers
2k views

Insert wp gallery shortcode into custom textarea

Is there a way to insert wp gallery shortcode into custom metabox textarea ? I would like to have something like this: New metabox in post/page with textarea and below textarea there are a button to ...
0 votes
1 answer
956 views

offset and max_num_pages in pagination gallery

I rewrote the code galleries and stopped at the pagination. How can I get the maximum number of pages? at the moment I can not define it, and put a test for the number 5. (Here "for ($ i = 1; $ i &...
0 votes
2 answers
1k views

show image gallery in archives or category page

i want to show image gallery in archives.php or category.php. The featured image and text content is showing but not image gallery. Below is the code inside category.php. I have tested to show one ...
0 votes
1 answer
32 views

Adding a css class to the gallery

I'm using WordPress 6.5 with the old editor, I'm trying to add a CSS class on the div gallery when it specified in the shortcode, the code doesn't work, can you help me ? function custom_gallery_class(...
0 votes
1 answer
1k views

Allow users to upload and display multiple photos

So basically I have a social website and I want for Wordpress users to be able to upload pictures and display them on their front end profile page. I have been looking into the user submitted ...
1 vote
0 answers
9 views

After moving content to a new site, gallery thumbnails are not pointing to media files

I am moving content from an old site based on Wordpress 4.9 to a new website based on the current release and PHP 8. I have moved all the content - meaning posts, pages, media, and so forth - using ...
0 votes
1 answer
905 views

Only current gallery images with get_attached_media

On my page the gallery images are cycled and I would like to show their title as a caption. Since get_post_gallery_images only retrieves the thumbnail-url of the gallery images I have tried to use ...
0 votes
2 answers
5k views

Any gallery plugins that allow commenting on single images?

I am looking for a gallery plugin that will allow users to comment on each individual photo as opposed to the entire gallery. I have tried Lazyest Gallery; however, it doesn't seem to be integrating ...
0 votes
1 answer
1k views

Remove Captions from Custom Gallery function.php

I like to prevent captions from being outputted in my custom gallery function. I could easily just hide it using CSS but it doesn't feel right. The caption is being sent from media.php this line. ...
0 votes
2 answers
2k views

ACF Gallery with Media Categories - how do display categories and sort

I would like to use something to filter images within an ACF Gallery. I have added the Enhanced Media Gallery Plugin which will allow me to assign a category to each image, but am not not clear on how ...
2 votes
1 answer
60 views

Bulk image importing from folders

I have hundreds of different named folders with various amounts of images inside each. I uploaded the folders to the wp-content/uploads directory. How can I import all at once into the media library (...
0 votes
0 answers
7 views

WP galleries in posts after import. How do I do it?

I moved the website posts with Wp All Export and All import, which worked fine, but many of the posts contained galleries (Wordpresses gallery with [gallery] shortcode). The problem is that now the ...
1 vote
0 answers
29 views

Issue migrating galleries has created shortcode with urls rather than IDs - any fix for this?

I've had to rebuild a site from scratch on a new platform, everything has worked fine using a mix of the built in import/export tools and WP All Import/Export. The only issue I'm facing is with the ...
0 votes
0 answers
16 views

Image shows up in editor, but not in published blog post

I'm having a problem with my blog page. I'm adding images to my blog posts and I can see them on my back-end however, not in the published blog post. Am I doing something wrong? example page is: https:...
0 votes
1 answer
672 views

Attachment Metadata inside of Loop

Basically, I'm trying to call attachment info to display withing a loop, for use in an image gallery. I know I need to use wp_prepare_attachment_for_js($attachment_id) but I can't seem to get anything ...
0 votes
0 answers
22 views

Galleries are limited to 12 images

I have used the wordpress gallery for my posts. with 10-40 photos per gallery. Since today, however, only exactly 12 photos per gallery are displayed in the all the posts on my website. (although I ...
0 votes
1 answer
487 views

Uploading images via ACF update_field function

I am trying to update image fields within a group in ACF via the update_field function I am successfully adding the images to the media gallery but I am having trouble getting them added to each ACF ...
1 vote
2 answers
466 views

Media changes not updating posts

What happens: Write a post Create a gallery Upload a random picture Set caption to "test" Publish Post Go to Media -> Select the picture from before Set caption to "changed" ...
0 votes
0 answers
49 views

Dynamic Gallery: Worpress' equivalents for Wix's collection and repeater

I am recently trying WordPress (the WordPress.com one instead of WordPress.org) to create a webpage that displays a list of events that the website visitors can participate in. I have been using Wix ...
0 votes
0 answers
120 views

Show an ACF gallery in a lightbox with thumbnails nav

I used "Foobox" plugin to show a ACF gallery (hidden) start from a single image. Here is the code used if ( have_rows( 'lsv_prodotto' ) ) { while ( have_rows( 'lsv_prodotto' ) ) { ...
0 votes
0 answers
41 views

Wordpress Gallery only allowed 10 times per post

I am trying to use the gallery shortcode multiple times within a post, two images per gallery, 15 shortcodes per page. It will only work as expected with modal popup for the first ten iterations, the ...
0 votes
1 answer
404 views

Customise the WordPress gallery html layout

I want change the WordPress gallery html layout, By default, the output of HTML is as follows: <div id="gallery-1" class="gallery galleryid-184 gallery-columns-3 gallery-...
0 votes
1 answer
39 views

How to calculate the sum of all featured thumbnail height on Wordpress?

In an archive page, I need to calculate the total height of a which is the container of many featured thumbnails, knowing that all the featured thumbnails have different heights (but the same width) ...
0 votes
0 answers
9 views

How to add more images horizontally to existing gallery using elemontor

I deleted all my unattached images from media as I had so many copies not being used and now I'm missing all my images in my gallery. The grid is already there so it should only be to upload add the ...
1 vote
0 answers
47 views

Change display size of one image in a Gallery block

I'm new to Wordpress. I've created a simple blog site, pretty much just out of the box, latest 6.2.2 version. When I create a post, it uses the block editor. When I create a Gallery block, and add ...
0 votes
1 answer
45 views

Gallery Block in template, validation fails after adding column number

I have set up a template in a block like so: const TEMPLATE = ['core/spacer', {height: '100px'}], ['core/gallery', {templateLock: 'false', columns: 2}] ; const ...
0 votes
1 answer
98 views

Trouble with Wordpress Gallery since update using has_block('gallery'

I've got a custom post type setup which displays a gallery below the hero. It's setup to display the first 9 images in a gallery using the following code, when one clicks the "View All Photos&...
1 vote
0 answers
71 views

Theme.json_ Set default columns for gallery

I want to set a default number of columns for the gallery block within the theme.json-file. Is that possible? I couldn't find anything regarding this. I tried some things under settings "blocks&...
4 votes
2 answers
8k views

Bulk edit wordpress images alt and title attributes

I uploaded around 600 pictures in different galleries in wordpress without setting the titles and alt attributes. I need to edit them, I was wondering a way to edit them by album, let's say the title ...
0 votes
1 answer
413 views

Custom Gallery Block - Uncaught TypeError: setAttributes is not a function

I tried building my own custom gallery gutenberg block as shown here to get more familiar with the block structure. Putting all the code into a single file works fine, but when I try to split it up in ...
-1 votes
1 answer
780 views

Issue on Getting Images URL of the Post Gallery

I am trying to get the URL of the attached galley into the post on custom page layout called Gallery Page. I tried to use the code from Codex at This Page (get post gallery images). but I am not ...
5 votes
2 answers
4k views

Cropped featured image replaces original image in gallery

Firstly, I have done my research as thoroughly as I possibly can. Searches have been made, but I have not found any advice or solution as to my exact issue. Ok, time to explain. Currently I am ...
1 vote
1 answer
4k views

Gutenberg MediaUpload component with default gallery functionality?

I have seen a few tutorials around utilizing the MediaUpload component from below. https://github.com/WordPress/gutenberg/tree/master/packages/editor/src/components/media-upload But none of them ...
5 votes
3 answers
25k views

How to show description under an inserted image?

I'm using wordpress' native media manager. I have a problem. I can show the title under the image. But I want also to show the description. Is it possible to do?
0 votes
1 answer
44 views

WordPress default gallery pagination when in page (is_page)?

It seems I have found the way to make WordPress default gallery pagination to work and to have control over URL forming: Pagination with WordPress default gallery? But when gallery call is in post. ...
0 votes
0 answers
140 views

Delete images from media library when user deletes an image from ACF Gallery

When a user deletes an image from the gallery in wp-admin I need it to be deleted from the media library too. I have a function using the acf/update_value hook which works uncorrectly. When a user ...
0 votes
1 answer
516 views

Custom default settings for WP native Gallery Block

I've started with MarkJ's answer - JavaScript included into the block editor. I wanted to control more attributes for gallery than linkTo — the number of columns, cropping, and image size. wp.domReady(...
7 votes
2 answers
2k views

Is it possible to query all posts that don't have an attachment?

I want to get a list of all posts that don't have an attachment and delete them. This question takes about getting all posts that have an attachment, but I want the reverse of it. The brute force ...
2 votes
0 answers
212 views

WordPress Block Variation for Gallery Columns

I had this code to extend the column count to 10 for a specific need. wp.blocks.registerBlockVariation('core/gallery', { name: 'prefix-gallery', title: 'Custom Gallery', attributes: { ...
0 votes
1 answer
586 views

Add anchor tag on previous_image_link / next_image_link

I am using big headers on my website.I need the next/previous_image_link to target to the picture , not the top of the page. Is it possible to add anchor or to set the target on next/...
1 vote
1 answer
284 views

Pagination with WordPress default gallery?

Here is the part of code handling pagination in functions.php: // Pagination Setup $current = (get_query_var('paged')) ? get_query_var( 'paged' ) : 1; $per_page = 3; $offset = ($current-1) * $per_page;...
2 votes
1 answer
8k views

How to get ID of images used in gallery?

How to get ID of images used in gallery? Using $gallery = get_post_gallery_images( $post ); I only get a string with thumbnails url, without image ID which is needed for basically everything. ...
1 vote
1 answer
955 views

Add a class to the anchor tag on HTML5 gallery

I want to add a class to the anchor tag of the HTML5 gallery, so I can use a lightbox plugin, but I do not know how to do that, i've tried with the code below, but without success. add_filter('...
0 votes
1 answer
357 views

How to get all attachment image from post ?? WordPress

I just want to get all atachment image from post with Alt, description, title, size, resotution and how to add DOWNLOAD button? i want to create image downloading website on wordpress for example LINK ...
0 votes
1 answer
251 views

how automatically show the image title before the image caption/description in a wordpress gallery?

I am using a simple Wp 5.x gallery like this [gallery size="full" columns="1" ids="6304,6305,6306,6307,6308,6309"] The gallery shows me the images and the captions/...
0 votes
0 answers
326 views

How to change Gallery image url in product page ? In function.php?

My code is like add_filter('wp_get_attachment_url', function($url){ if(strstr($_SERVER['HTTP_ACCEPT'], 'image/webp')!=false){ return $url.".webp"; }else{ return $url; ...
7 votes
2 answers
6k views

Validation error: Extending Gutenberg gallery block

I am trying to extend the Gutenberg core/gallery block to add some new functionality to my image gallery on the frontend. I have created a separate plugin to handle this task. I have registered my ...

1
2 3 4 5
16