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
344 views

Import Attachments - not attaching to post_parent

I've set up a dev site for a client, for who we're overhauling their existing site. One thing I wanted to do is import all their existing news posts, and carry over any images attached to those. I've ...
0
votes
1answer
85 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
2answers
196 views

Associate an existing image with a post

I'm trying to associate an existing image from the media library with a post (It's a custom post type), If I use wp_insert_attachment I get a duplicate in the media library, so I'm getting the image ...
1
vote
0answers
59 views

How can I append custom data to images in the editor?

I've added a custom meta field to my image details so that a client can add a number to their photos (a design choice). The data would need to show up under each image (like a caption) inserted into ...
0
votes
0answers
92 views

List Post Attachments Conditionally Based on File Name

I am trying to display the attachments of a custom post type based on their file name (numbering at the end) and then assign it to a title. I have 10 pre-defined titles that I want to link to a ...
0
votes
1answer
124 views

Post images not displaying as attachments

I am trying to display the images attached to a post in single.php I've used : <?php if (have_posts()) : while(have_posts()) : the_post(); ?> $args = array( 'post_type' => 'attachment', ...
0
votes
1answer
47 views

Show title when inserting single images

I just can't get how to do this. When inserting a gallery I have this output: <a href="path_to_files/image.jpg" title="fancy title"> <img width="150" height="150" ...
1
vote
1answer
999 views

Image Attachment Url Rewrite

I'm having an issue with url rewriting for a theme I'm making, which is basically a gallery theme based on the roots theme. Here's how the site navigation works: Home Page (With Tiled Image Gallery) ...
0
votes
1answer
103 views

Get Attachment Image Class by attachment id

I want Get wordpress media library image class. I have attachment id and I tired this but won't able to get it. print_r(wp_get_attachment_image_src( $attachment_id, $size, $icon, $attr )); How can ...
0
votes
1answer
68 views

Applying class to links around self hosted images embedded to posts/pages

So I need to add a class to links around the images for lightbox purposes. But only to images from the upload directory, not to external ones. I've found this solution by @TommiForsström here: ...
0
votes
0answers
71 views

Line break issues with textarea in admin for Attachments

I am not sure if this is an issue with Wordpress, PHP or the Attachments Plugin. I am using the Attachments plugin to save attachments to a post with some meta information. One of which is a caption ...
0
votes
1answer
47 views

Move caption in on attachment page

I am looking for a way to edit the way Wordpress’ native gallery displays images when clicked on. Specifically, I need to move the title below the image. A more detailed explanation: I setup a ...
3
votes
1answer
290 views

Bulk term assignment for attachment taxonomies

I've created a custom taxonomy for attachments. Everything ok, but now I want the ability to bulk assign its terms to attachments using the default wordpress media admin ('upload.php') bulk actions. ...
1
vote
1answer
300 views

Delete all thumbnails for a post

I have a function that sideloads a YouTube thumbnail onto a page... but I want to remove the featured thumb on the page first (and remove all the various auto-generated sizes, too). I'm assuming I ...
0
votes
1answer
106 views

list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not

On single.php theme template file, I'm displaying the post's list of attachments. global $post; $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' ...
0
votes
1answer
221 views

Show selected images on top in Media Manager

I've searched numerous StackOverflow and Wordpress Awnsers questions, but I couldn't find any solution that matches my situation or even remotely points me in the right direction. I have a custom ...
0
votes
1answer
220 views

Get all attachments by custom taxonomy - term

I want to make custom taxonomy (gallery) and terms (name1, name2, name3...) Add images into media tab and then retrieve all images from same term. Look like simple task, but I cant manage it. I ...
0
votes
1answer
63 views

Custom attachment field dissapearing

I'm adding a custom attachment field to the media uploader using WordPress' "attachment_fields_to_edit" and "attachment_fields_to_save" filters, which works fine initially after uploading an image ...
0
votes
1answer
77 views

What is the way to add additional fields to attachments in 3.5+?

I used to use attachment_fields_to_edit filter, but it seems that in 3.5+ it has been dropped. What is the new way of adding additional attachment fields? UPDATE: It seems that it wasn't dropped, ...
5
votes
2answers
475 views

Delete Associated Media Upon Page Deletion

Note Use at your own risk, it is buggy and I have run across a couple instances where it would delete ALL attachments. Unsure why. Is it possible to delete media associated with a page when that ...
1
vote
1answer
361 views

Exclude featured image from attachment loop

For my jigoshop theme I'm able to retrieve the images attached to my product post. However it pulls all images from both the featured image and my metabox images. What I'm trying to do is make it so ...
1
vote
1answer
89 views

How to upload image without post ID using the new media uploader?

In the past when using thickbox to upload images, an image could be uploaded without having the post ID 'attached' to it by simply using the code below : ...
0
votes
1answer
80 views

Adding thumbnails for non-image attachments

I'm working on a site that provides Photoshop resources. I would like to create a page offering brushes for download that displays a thumbnail image and a link to a .zip file for each brush set. I was ...
0
votes
1answer
530 views

post_author for wp_insert_attachment

I am working on a custom theme, in which I need to programmatically inserts posts and attachments. One requirement is those posts belong to users that are not the user who is logged in and running ...
1
vote
1answer
64 views

Can't update old posts 3.5.2

Background: I'm working on a customers site that I haven't build myself. The site works pretty ok, when I got it the wp_header and wp_footer was missing and the javascript files were all linked to ...
0
votes
1answer
16 views

How can I let users access a specific attachment?

I'm trying to add a XML file to my site that users can access when I give them the url. www.domain.com/blank01/blank02/file.xml As of right now, blank01 and blank02 don't exist as pages. Down the ...
1
vote
0answers
30 views

Rewrite all article pictures to link to file

I got a wordpress blog with thousands of articles. The problem: I want to use a lightbox plugin(http://wordpress.org/plugins/fancybox-for-wordpress/) but in order to work the pictures in an article ...
0
votes
3answers
217 views

Calling a javascript function in post edit page after attaching something to post

I would like to call a javascript function after user attaches something to post. I hooked the add_attachment hook, and processed what I want. However, how can I call a function in a Javascript loaded ...
0
votes
1answer
44 views

Attaching images to posts manually (i.e. with custom code, without the use of an API)

I am working on mobile API for a WordPress site. The API is written in PHP and provides methods actions such as creation of a post. Now, I can create a post with one image (thumbnail) of the post. ...
0
votes
1answer
90 views

How to get boolean if file A is attached to post B

I created a kind of customer area using several password-protected posts (for more details check this, but it's not necessary for this new issue: Give visitor access to password protected page/post ...
0
votes
1answer
58 views

How to get the cropped image from media library?

i have the url of an image (full size). During the upload it already generates a smaller version (i added this in functions). How can i get this cropped version when i have the full size url? The ...
0
votes
1answer
52 views

has_excerpt yields true but no post_excerpt when retrieved

echo has_excerpt($att); //Results in True echo $att->post_excerpt; // results in empty. echo $att; // results "782" which is the ID of the attached image. If I use get_post_meta( $att , ...
0
votes
3answers
728 views

How do i get post thumbnail using attachment code

Hi i'm using this code below, which links the title of the post to the first attachment in the post. But how do I change it so that it grabs the thumbnail instead? <?php $args = array( ...
0
votes
1answer
134 views

Post Title Not showing up

Hi i'm using this code to call post from a certain category <?php $queryObject = new Wp_Query( array( 'posts_per_page' => 3, 'post_type' => array('post'), ...
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 ...
0
votes
1answer
54 views

View list of all attachments on site

I'm new to WordPress theme development and I'm trying to figure out if there is a way to display a list of public attachments similar to how you can view a list of posts with a specific tag or author. ...
0
votes
1answer
127 views

Get images attached to a specific page

Is there a way to fetch the URLs and captions of all images attached to page x?
0
votes
1answer
29 views

Automatically deactivate link for attachments

It's probably super easy. I know it can be done when uploading stuffs to WP but I wonder if there is a simple snippet or setting to automatically deactivate link on attachment. For example : I do ...
0
votes
1answer
535 views

Add suffix to filename of uploaded images

I registered 3 custom image sizes (Double sized, for retina displays) with add_image_size: thumbnail@2x, medium@2x and large@2x. function retina_image_sizes() { $retina_sizes = array( ...
0
votes
1answer
65 views

open image after clicking on single.php with different stylesheet in wordpress

i have single.php like if(have_posts()) {while(have_posts()){ the_post(); //content displayed }} in the content i have some images. As i click on the image it opens in very simple manner without ...
0
votes
1answer
59 views

Target all images that are not the first attachment

I'm querying image attachments on a template I'm writing. For a layout purpose, I'd like to apply a css class to all the images that are not the first. Here is the code I'm currently working on, I'm ...
0
votes
3answers
157 views

search through post-type attachments titles

I have a page where I show all the attachments of a page in a table which has id=10. I have hundreds of attachments and I would like to implement an AJAX search form that uses the title of attachment ...
1
vote
1answer
72 views

Custom attachments styling in post view

I am looking for easy styling list of .doc attachments in post. For example i want to put every in <li></li> tags and do some proper styling. So far I am get my post content this way: ...
0
votes
1answer
479 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
0
votes
1answer
114 views

Attachments broken after giving WordPress its own directory

I set up a fresh WordPress installation in a folder called 'wp' under root. I followed the directions for Giving WordPress Its Own Directory and pointed the URL to root successfully. I then proceeded ...
1
vote
2answers
3k views

Password protect some uploaded files, so only logged-in users can view them

I would like to protect some uploaded files, so that they are not publicly accessible (they are not accessible without a login). I'm uploading some PDF files, and I'd like to mark some of them as ...
5
votes
1answer
3k views

simple solution for restricting access to (some) uploads/downloads

Initial Situation For a site I'm setting up I was looking into the whole field of securing uploads/downloads and restricting access to them based on user roles/capabilities. Of course I have read ...
0
votes
0answers
170 views

uploading Attachments with permalinks based on parent file structure

We are rebuilding a public-interest site centered on civil rights research & document archives. The links in years of published info posts must be preserved in WordPress, and future uploaded ...
0
votes
1answer
162 views

get_attachment_link() adds a hashtag to URL

I'm using the get_attachment_link() function in a site I'm developing and it's returning a really weird result. For some reason it adds #main at the end of every url. ...
0
votes
1answer
53 views

How to retrieve images contained in a post

I'm working with the new media manager, and have a little issue to retrieve the attachment of the post. I'm developing a plugin which needs to retrieve all attachments of specific posts. I first ...