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
1answer
126 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
325 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
182 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
597 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
206 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
211 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
493 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
137 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
223 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
270 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
563 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
136 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
766 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
284 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
97 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
434 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
142 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
69 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
78 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
248 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
316 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
229 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
193 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
1answer
741 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 :)
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
225 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
80 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
603 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
370 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
318 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
277 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
187 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 ...
1
vote
1answer
271 views

Don't show attachments if they are inserted in post

I have attached images that I have inserted into my posts but they also appear in the attachments box at the bottom of the post. I'd like to know how to make them not appear in the attachments box if ...
2
votes
1answer
683 views

Adding class to next/prev image link in attachment.php

Is it possible to add a class or ID to next/prev image links in attachment.php? I tried like this but it didn't work: <?php next_image_link( false, 'Next', array('class' => 'next')); ?>
0
votes
1answer
618 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 ...
2
votes
2answers
2k views

How can I hide media library images from general users?

As an admin I really like the features and functionality of the WordPress 3.5 media manager. With a multi-user site however all users can see all images in the media library - whether uploaded by ...
2
votes
1answer
643 views

Get attachments (get_posts) and WP 3.5 new uploader

I'm using get_posts() to get attachments from the post and use it in the slider. The issue is new uploader doesn't have that "Gallery" tab which was perfectly suitable for this. It also seems to be ...
5
votes
3answers
4k views

How to use taxonomies on attachments with the new Media Library?

WordPress 3.5 changed the media management and now the Media Library edit screen uses the default post type UI. Taxonomies are very useful for WP installs with different users and attachments, giving ...