0
votes
1answer
43 views

Custom Gallery HTML only working when images are attached to post/page

I have changed my gallery html using the posts_gallery hook in the same way as shown here:How to customise the output of the WP image gallery shortcode from a plugin? I've copied the latest code from ...
1
vote
1answer
521 views

Add an image gallery to a custom post type?

I am pulling data from an external web service into a custom post type. This data includes images. How can I create an image gallery, add some existing attachments to it, and associate it with a post? ...
0
votes
0answers
58 views

Reorder “menu order” of attachments to another predefined order

I want to show photos attached to a post in a gallery using the built-in system with a custom order. Currently with the [gallery] shortcode it is posible to order it by name, by upload date, by ID, ...
0
votes
1answer
81 views

Get a Page's attachments in Gallery order

Having created a page and a gallery within that page, I would like to retrieve all the images in that gallery in the order they are set when the gallery is created, i.e. the order which I drag them in ...
0
votes
0answers
57 views

Wordpress gallery image link gives 404 when not logged in

I'm attempting to use the default Wordpress gallery (from the post editor 'Add Media' then 'Create Gallery'). When logged in as an admin and clicking an image in the gallery on the resulting blog ...
4
votes
1answer
1k views

How to paginate wordpress [gallery] shortcode?

I am using wordpress gallery shortcode [gallery] I was wondering if there is anyway to paginate them without using a plugin.
0
votes
1answer
476 views

Ordering of gallery images without using shortcode in theme

I using the built-in gallery in wordpress to store and sort images inside a custom post type. In the theme I was using: $attachments = get_posts( array('post_type' => ...
0
votes
1answer
1k views

wp_get_attachment_link() add rel attribute if the link points to direct image

I'm using filter like this to add rel attribute in wp_get_attachment_link() add_filter( 'wp_get_attachment_link', 'sant_prettyadd'); function sant_prettyadd ($content) { $content = ...
0
votes
1answer
133 views

WordPress Gallery Permalink Structure Displaying Incorrectly

When an image is added to a gallery, the resulting attachment URL is generally displayed in a structure like this: example.com/post-slug/attachment-slug/ However, take a look at my gallery: ...
1
vote
1answer
192 views

Display random gallery images and its parent post title leading to parent post permalink

I usually have a gallery in posts. I want to display random image and its post-title from a random published post which can lead to permalink like related posts below a post. I used this code: ...
1
vote
4answers
6k views

How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?

I am trying to retrieve all the images from the Gallery of a page in the order they are set in the backend. So far I have: $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query( ...
0
votes
1answer
552 views

ID of images from wordpress galelry

Does anyone know how to get ID's of images from wordpress gallery in post? I have search entire internet and there is nothing to this subject. Thx for your time :)
0
votes
1answer
263 views

Use full size images in a specific gallery

Thumbnails are displaying as 100px however the full size is 130px which is what I want. I want this only in one specific gallery. Also would like to link each gallery thumbnail image to an external ...
0
votes
2answers
176 views

One picture belonging different galleries?

How can one picture belongs different galleries? For example, there are two galleries. I want to avoid loading the image twice (in two galleries) but it shown (included) in the first and second ...
0
votes
1answer
558 views

How to get the next and previous image title from attachment or gallery?

I'm trying to build a slider exactly like this in wordpress. I have managed to make the slider work except the next/prev button. I need to get the next image title and the previous image title for the ...
1
vote
1answer
78 views

Where does the gallery shortcode gets its attachments from?

I know that media are an attachment post type that are children to a post, but how are galleries stored in WordPress?
1
vote
1answer
1k views

How to remove title attribute from gallery links and images

I want to remove the title attribute from within the output of a [gallery] shortcode e.g. <a href="url" title="bobby"> <img src="url" title="bobby"/> </a> should be: ...
1
vote
0answers
258 views

Align text left of image in this php script? [closed]

Ok so i am using this code, which allows me to upload photo's to a post and instead of inserting them myself, it calls all the photos attached to the post. Thus for placing all the photos in the post ...
0
votes
1answer
90 views

How to save media-form on custom tab

On my custom tab, I copied media-form from media_upload_gallery_form, only changed form id and action-url to reflect my tab's name. The form displayed as expected, but after click "Save All Changes", ...
0
votes
1answer
143 views

Excluding post thumbnail from the attachment.php when using wordpress gallery

I am looking for this answer everywhere and can't find it. I setuo the wordpress default gallery using the attachment page which shows next and previous photos. everything is working fine and I have a ...
1
vote
1answer
415 views

Exclude images from “inserted into post” when trying to get attachments

I have here the coin-slider which takes all pictures from the gallery. I get the attachments through the following code: $attachments = get_posts(array('post_type' => 'attachment', 'post_parent' ...
0
votes
2answers
2k views

How do I get just the title from wp_get_attachment_image

I can get the image to appear fine in this bit of gallery code. However the flex slider gets its caption from a <p> tag (class="flex-caption") and I just need to echo out the image title inside ...
0
votes
1answer
477 views

changing the default picture size link url

when i'm inserting a single picture thumbnail from the gallery with a link to the original picture, it gives me this: <a ...
0
votes
1answer
1k views

Get all images from posts with maximum number and without featured image

I recently asked a question on how to get all images from all posts - and I got a working answer, but unfortunately the code gets post-thumnbnails as well, and I didn't find a way to limit the number ...
1
vote
1answer
2k views

Gel all image from certain post type

I've found similar questions here, however I can't modify the answers to get images only from a certain post type - as the post type in those examples are "attachment" and not the name of a custom ...
0
votes
1answer
172 views

Gallery Thumbnail Layout Template

Is there a way to create a template to display a gallery thumb layout? Or am I stuck with selecting a thumbnail size and rows in the upload image/gallery area and media settings area?
1
vote
1answer
1k views

attachment.php code or tutorial

I am confused about the exact purpose attachment.php ( and image.php) . I notice many themes dont have them. If single.php displays the image the way I want then is it OK to leave it out. On the other ...
0
votes
2answers
3k views

Add image attachment to post via coding?

I tried to add an image as Attachment image to a post. in wp_postmeta i added _wp_attached_file as meta_key and value = productimages/Routers/v/CISCO1941.jpg it not works and i could not see the image ...
0
votes
1answer
122 views

Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?

I would like to style the attachment page for each gallery differently, but i'm not sure how (sorry for the noob question, i'm still new to wp development!). I was hoping i could use Attachment.php ...
2
votes
1answer
132 views

Getting attachment images is cloning some of them

So, i got this code to retrieve the images inserted in a gallery within a post: <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, ...
1
vote
3answers
1k views

Hide “Gallery Settings” and “Insert into Post” button from Attachment window

I'm using different method to form a gallery in Wordpress, so I would like to hide an option to insert images and galleries into post for anyone but Administrator. Can someone show me an example how ...
2
votes
1answer
2k views

Retrieving a custom link on an attachment

I wanted to link images in a gallery to a custom URL. I know I could add an extra field and do it this way I found this ticket on Trac, though, that modifies the "Link URL" field to accept custom ...
3
votes
2answers
512 views

how to test for attached image

I am trying to find out whether or not a post has images. If it does, I then want to know if a featured image was specified for the thumbnail - if not, the get_thumb() function will assign an image ...
11
votes
2answers
3k views

Turn a URL into an Attachment / Post ID

Is there any way I can take a URL of an image and find the attachment or post id of that image in the database? Here is the situation: I'm in a loop going over all the 'img' tags that are surrounded ...