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
48 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
84 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
3answers
2k views

Create post from form with image

I found this wonderdul script that @Bainternet here at Wordpress Answers created, that makes it possible to attach images into posts from a html form.. I tried to combine in into my "html form to ...
0
votes
1answer
232 views

add image caption

I would like to add caption to a image I just uploaded through a from. So I have the attachment id and the caption text in a variable. I found wp_update_attachment_metadata in wordpress codex .. but ...
0
votes
1answer
373 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( ...
1
vote
1answer
610 views

Image still attached to post even after removing it as featured image

I'm sorry if this is too noob of a question, but when I upload an image and set it as the featured image then later remove it (as featured image), the media list still shows it's "Attached to" the ...
0
votes
1answer
27 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
0answers
27 views

How can I create an edit media thickbox link?

After uploading an image to a page or post, you can click an icon/link in the top left corner to open a thickbox editor and edit its properties at any time. I have a a situation where I am uploading ...
0
votes
1answer
57 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
3answers
120 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 ...
0
votes
1answer
51 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 ...
1
vote
1answer
63 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
98 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 ...
0
votes
0answers
135 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
0answers
71 views

Editing with thickbox in wp-admin - Endless loading

I have a plugin with images inside wp-admin. Works fine without thickbox When clicking on an image I can edit them with this URL: ...
0
votes
1answer
52 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 ...
0
votes
1answer
102 views

Bulk Attach Or Insert Media To Post Without Opening Post Editor

How to create a custom panel inside wp admin dashboard where we can insert media to specified posts in bulk? Here is the illustration: As shown on the image above, it list all available media on ...
0
votes
1answer
172 views

How to search for post content and attached file names

I need to extend standard WP search functionality so that the search term is also applied to files attached to a post. In other words if user types in "annual report" then search results would include ...
3
votes
1answer
111 views

WordPress comment count to include attachment comments

How can I make the comment count on a post on my index page include comments that have been made on, in my case, individual gallery pictures that are included in the post? It seems that comments made ...
1
vote
1answer
6k views

how to get original image using wp_get_attachment_image_src

I want to get the original image with the same width and height as uploaded. My original image is 630*370. Using the following function call I get a thumbnail sized at 630*198. ...
1
vote
0answers
76 views

Show message in media-new.php

I'm wondering if there's a way to show a specific message when user uploads a file using the wp-admin/media-new.php script. So far I have this: function my_uploads_notice(){ global $pagenow; ...
0
votes
1answer
99 views

How to attach images that I “insert from url” into the post?

I'm trying to get the list of images in my post, to display them in the front page... the problem is that when I add a new picture from a URL, it doesn't seem to attach it. $images =& ...
0
votes
0answers
87 views

Add to the library a media from a subfolder

I'm trying to upload some media to the media library in a "uploads" subfolder. The problem is that the media is added, I can see a new entry in the media library, the database the guid of the file ...
0
votes
0answers
88 views

How to upload images using <form> as a post thumbnail?

In my custom image upload form, codes are (generally): if(isset ($_POST['submit'])=='Submit') { $product_image_1=$_POST['product_image_1']; $product_image_2=$_POST['product_image_2']; $newPost = ...
5
votes
1answer
5k views

Get all image from single page using this query

I'm having some trouble with this sample widget code. I want to get all images (Minus the post thumbnail) from a page called "Gallery" but for some reason this is pulling all uploaded images from the ...
0
votes
1answer
217 views

How to add filetype to meta value when using wp_upload_bits?

I've set up a custom post type and would like to have the ability to attach files to those posts. I've got the CPT and metabox set up, and the upload function as well. When I display the CPT on the ...
4
votes
1answer
101 views

Theme Customiser Image Control

I'm aware that one can add a control to the theme customiser to add an image. This control returns an image URL however, and I need its attachment ID, not the image URL. Where can I intercept or ...
1
vote
2answers
2k 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' => ...
2
votes
1answer
303 views

Delete attachments from Front end

I am trying to make a simple media manager on the front end of my posts, as my site will have many authors. I want to give them the ability to delete any picture attachments that they have uploaded to ...
2
votes
1answer
1k views

get_the_post_thumbnail() doesn't taking style attribute

This seems to be an easy one but its giving me quite a hard time. get_the_post_thumbnail() suppose to take attribute as an array. Well, everything working right but when i pass style attr its doesn't ...
0
votes
0answers
241 views

Delete associated thumbnails when calling wp_delete_attachment

I have a somewhat straightforward script that allows users to upload their own avatar from the front-end. Another script allows them to delete their avatar, before uploading another. The ...
0
votes
2answers
197 views

How to move image attachment from post to another?

How to move image attachment from post to another (not to "Remove Permanently" and Re-Upload) ? I'm using WordPress 3.5.0 and I have a thousand images to process. Is there a built-in function for ...
0
votes
1answer
412 views

Retrieve Image Attachments Getting Post Thumbnail Image First

I have written a funtion to get post image attachments, is there any way of ordering these images such that the first is always the post_thumbnail? Code below Thanks John function ...
4
votes
2answers
724 views

How to get attachments for a specific post type?

I have this page where I am showing all post's attachments. This is the code: <?php $args = array( 'post_type' => 'attachment', 'post_status' => 'published', 'posts_per_page' ...
2
votes
1answer
28 views

Set attached to state

In the media library every attachment post has an "Attached to" column. I've developed a plugin that adds author profile and a facebook like banner image. I now discovered that the attachment posts, ...
1
vote
0answers
169 views

How to create resized versions of images added with wp_insert_attachment

I'm uploading images to my media gallery and setting them as my post's featured image, which is working quite well. I'd like to generate thumbnails of these featured images, in the same way that ...
0
votes
1answer
44 views

What is the most efficient way to retrieve a group of image URL's from different attachment ID's of a specific crop size?

I have a basic slider plugin that I am attemping to make more efficient. This plugin collects an array of attachment ID's from the user to represent each image of the slider. With these attachment ...
4
votes
2answers
1k views

Delete original image - keep thumbnail?

I'm using a lot of thumbnails but never the original file. To save space, I'd like to prevent the original from being saved on disk but only keep a thumbnail of 100px. How can I do this? Thanks, ...
0
votes
0answers
61 views

Custom post types images go to a specific folder, not the montly one

I have a website which allows "mini sites", meaning custom post types. We noticed that the images that are published along the mini-sites reviews go automatically to the same month, while regular ...
0
votes
0answers
93 views

delete attachment for one post without deleting actual attachment post

I'm writing custom ajax calls for media attachments from FrontEnd, I have everything read to use, except the actual logic. I'm using WP E-Commerce plugin, where I want many images for one post. And I ...
0
votes
1answer
394 views

Display Audio Attachment URL

To get the image url from a Post Thumbnail in WordPress to display it in a template, I would use: <?php $image_id = get_post_thumbnail_id(); $image_url = ...
0
votes
2answers
5k views

Displaying an image's alt title and caption inside a fancybox window. Working, but showing the same alt and caption for each image

I've been at this for hours so maybe someone here can help :) Basically I have a fancybox gallery that loads images attached to a post. As you can see below, I want to echo either the image's caption ...
1
vote
2answers
212 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
votes
1answer
68 views

How to link images of one WP site to another WP site?

My first site is having 92 categories to display more than 10,000 SMS. Now I want to insert random images to all my posts (SMS) from my other site which is having images as per my categories in SMS ...
0
votes
2answers
158 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
314 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
1answer
369 views

Contact Form 7 Data As Attachment

I want data submitted through Contact Form 7 to be sent as an attachment as opposed to text / html inside the email body. Specifically I want this attachment to be in CSV format, which should be ...
0
votes
2answers
468 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 ...
0
votes
1answer
108 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 ...
1
vote
3answers
156 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 ...