An attachment is an image or other file uploaded through the post editor's upload utility. Attachments can be displayed on their own 'page' or template. For more information, see Using Image and File Attachments.

learn more… | top users | synonyms

0
votes
2answers
214 views

the_time() returning wrong date/time (way in the future)

Within a loop, that otherwise works fine, the_time() is giving me a date and time about 25 days and a few hours ahead of the actual date.For instance, if I post today, it lists it as "April 30th, ...
0
votes
1answer
598 views

Problem adding MP3 attachments to a jPlayer playlist

I'm trying to get a post's mp3 attachments working with the jplayer plugin (with playlist addon). I have it working for a set number of attachments, but am failing to find a dynamic solution for any ...
0
votes
2answers
808 views

How to create a multidimensional array with multiple loops

I have this loop where I loop through every post of my CPT and fetch the title and the content of each post and put it into an array. That is no problem. But as it happens I have created a repeatable ...
2
votes
1answer
206 views

Rename attachments during upload

Here's the function I use for WP to rename images during upload on the fly and set the image's filename to match the post slug. function wpsx_5505_modify_uploaded_file_names($arr) { // Get the ...
0
votes
1answer
158 views

How to let a role handle media without post permissions

I have a CPT to replace my "post"-post-type, but I still need to be able to use attachments. The problem is, that attachments have the post-capabilities. I don’t want to give post capabilities to my ...
0
votes
1answer
175 views

Import Dummy Content and Post Thumbnails

I am setting up a small dummy content plugin. What I would like to do is import several posts using wp_insert_post. Then I would like to import several images using wp_insert_attachment and then ...
0
votes
1answer
131 views

Hiding or removing file extension displayed in HTML on attachment page

I’m doing up a photography theme in WP at the moment, and I’ve already got great help on this thread (thanks Milo!) for a previous question. In that thread, I asked about displaying the file name of ...
1
vote
2answers
336 views

Image rotation fails to regenerate custom sized thumbnail

I'm using custom image dimensions in functions.php like this: add_image_size( 'custom-size-thumbnail', 120, 120, true ); I uploaded some pictures with wrong orientation, so I used "edit" options to ...
1
vote
3answers
183 views

Out of memory error reporting

When users upload very large photos and memory is tight, it seems like Wordpress runs out of memory - fails to resize the uploaded photos and does not create the necessary metadata ...
2
votes
1answer
612 views

rename attachments based on parent-post-title on upload

I know there a some functions already avaible here for this task, but none of them seem to work as needed. The best way seems to me adding a filter to wp_handle_upload_prefilter like kaiser does in ...
0
votes
1answer
212 views

Adding attachment file name to email link

I'm doing up a photography site where each post is a photo project, and each post attachment will be displayed on its own attachment page (linked to from the main post page). On the attachment page, ...
1
vote
2answers
3k views

How to single click to download image in single post

i have attacment.php like this. <?php if ( $attachments = get_children( array( 'post_type' => 'attachment', 'post_mime_type'=>'image', 'numberposts' => 1, 'post_status' => ...
5
votes
1answer
1k views

Saving images from Gravity Forms repeatable File Upload as post attachments [closed]

I am trying to upload multiple images as attachments to a post using Gravity Forms and the Gravity Forms + Custom Post Types plugin. I have a repeatable File Upload field using the Gravity Forms ...
0
votes
1answer
225 views

Change filename during upload

I check the below answer to rename files during upload and tries to change it to something like postid_originalfilename.jpg but failed. Any help? function make_filename_hash($filename) { $info = ...
1
vote
2answers
506 views

Link all Wordpress images size

How i can link all different images size upload in wordpress? I've definited different size image with the plugin simple image size so i'ld like show in single post, links to all new images example ...
0
votes
1answer
43 views

Image attachement management - a philosophical question

I'm building a theme which includes displaying images which are not embedded in the body of the post by the user. I understand the correct approach to this is to use the concept of attached images - ...
-1
votes
1answer
138 views

Custom Fields, Media uploader, Attachments

I have added Custom Fields to the Media Uploader in WP3.5. I am unsure of how to have that data displayed on the Attachment page.
2
votes
1answer
233 views

Rename attachments during upload no matter what filetype

Here's the function I use for WP to rename images during upload on the fly and set the image's filename to match the post slug. function wpsx_5505_modify_uploaded_file_names($arr) { // Get the ...
4
votes
1answer
2k 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
289 views

How To Download WordPress Audio Attachments

I've been searching high and low trying to figure out how to create download links for audio files uploaded to a post. I know how to display the audio url directly into the theme template, but when ...
0
votes
1answer
582 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
2answers
137 views

get_permalink to attachment not working

I have following code <?php $args = array( 'post_type' => 'attachment', 'numberposts' => 12, 'post_status' => null ); $attachments = get_posts( $args ); if ( ...
1
vote
1answer
792 views

Insert custom ID into wp_get_attachment_link

I'm working on this function of WordPress. function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { $id = intval( $id ); $_post = ...
0
votes
0answers
18 views

wp insert attachment from local drive [duplicate]

Is there some way to upload images from local drive to posts without using dashboard. Something like function wp_insert_attachment, bur for that function is a rule that files must be on server.
1
vote
1answer
287 views

Show how many images are attached to a post/page on compose page

On the front-end, I'm using a query to show all attachments attached to the current post. However, on the compose page, there's no way for a user to see how many images are attached without opening up ...
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 = ...
1
vote
1answer
99 views

How To Grab All Type Of Attachments, But Images?

I need to get all file attachments which is not an image, 'post_mime_type' only accepts "any" or specific mime types, How to grab all type of attachments, but images?
0
votes
1answer
150 views

Add audio attachment link to RSS

This is how I'm adding a featured image to my RSS: function featuredtoRSS($content) { global $post; if ( has_post_thumbnail( $post->ID ) ){ $content = '' . get_the_post_thumbnail( $post->ID, ...
0
votes
2answers
447 views

After changing permalink structure, How to redirect attachment url to old parent post url

I change my permalink structure successfully. /%year%/%monthnum%/%postname%/ --> /%category%/%postname%/%post_id%/ But now I face a problem. Before change my permalink, I redirect my ...
0
votes
1answer
150 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
0answers
144 views

How to edit attachment with media-upload.php?

I'm looking to edit an attachment and I'm trying to supply a link to the existing preview image. <a href="media-upload.php?type=image&TB_iframe=true&" class="thickbox" title="Edit Image" ...
0
votes
1answer
72 views

dynamically get post attachment while editing

I want to show a meta box on the post edit screen, that contains a list of the images attached to the post. I need the meta box to work for new posts as they are being created. It should update ...
2
votes
0answers
81 views

Page Attachment Permalink Structure based on Menu Order?

I've been on a quest for the past couple of days reading up on Rewrite in WordPress but still can't seem to figure out how to accomplish this. When using pretty links in WordPress, media attached to ...
0
votes
2answers
2k views

Why can I not view image attachment pages?

I have a problem with images. I can see my uploaded images, as previously, through the media library. I can access each image by clicking on "edit". But if I then click on "View Attachment Page", I ...
2
votes
1answer
1k views

Saving Custom Field in Attachment Window in WordPress 3.5

I'm using the code below to add a custom text field in WP 3.5 Attachment Window (from this question # Expanding new Media Uploader in WordPress 3.5) ... add_filter( 'attachment_fields_to_edit', ...
2
votes
2answers
254 views

Correct Way To Show Custom Taxonomy for Image Attachments on Template File

I've created a custom taxonomy called imagetags using the following code: // Register Custom Taxonomy function custom_imagetags_taxonomy() { $labels = array( 'name' => _x( ...
5
votes
1answer
328 views

Remove duplicate attachments

Here is the situation: I have an automated script that upload attachments and link each attachment to a specific post. By mistake, the script run multiple times and I have the following More than ...
1
vote
1answer
239 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: ...
2
votes
4answers
8k 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( ...
-1
votes
2answers
1k views

Add an attachment feature to comments

Is there a way to allow attachments with wordpress comments? I know of a paid plugin that allows this but I was hoping for someone to point me in the correct direction that's future proof and doesn't ...
0
votes
2answers
206 views

Upload image and assign it's id to post

At the moment i am working on database conversation script from other cms to Wordpress and faced one problem: I have a list of images, so i need to upload it to Wordpress, after it receive new link, ...
0
votes
2answers
810 views

ID of images from gallery

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.
1
vote
2answers
221 views

Image Gallery Numbers for 3.5

In previous installations of WordPress it was possible to number images in attachment.php using the code below, which was originally provided here. However, I'm finding that this code no longer works ...
0
votes
1answer
229 views

Show list of custom posts with respective attachments?

I would like to construct a query to show a list of custom posts ("podcasts") with the urls to their respective attachments. Each custom post_type ("podcast") has 1 attachment (the mp3 file belonging ...
0
votes
1answer
82 views

How do I add multiple post types to this query?

The code i use calls for all attachments that are uploaded to be in the post. I added the Gallery custom post type but nothing shows. It shows on my "pretty-little-liars" post type though. What am I ...
1
vote
2answers
633 views

How can I attach hotlinked images in posts/pages within the same server?

Not sure if this makes sense but I'm trying to attach hotlinked images to their posts/pages with no lucky, most plugins such Cache images works ok but only to external domains, I need to auto-attach ...
1
vote
1answer
374 views

Multiple images in one attachment page

I want multiple images for one post attachment page, but there is no option for that. How can I do that?
0
votes
1answer
336 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 ...
3
votes
1answer
281 views

On Multisite: Loop to Show First Four Images of Recent Posts Across Network

I would like to display the first four images from posts across a WordPress network. In Otto's image gallery tutorial he recommended using the following to get images from recent posts. Query ...
0
votes
2answers
188 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 ...