Tagged Questions

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

1
vote
1answer
520 views

How to delete all post and attachments of a user when I delete it?

When I delete a user, WordPress can just delete the post or page of this user, not his custom post and his attachments. An idea for a special hook? add_action( 'delete_user', 'my_delete_user'); ...
5
votes
2answers
2k views

Expanding new Media Uploader in WordPress 3.5

In current version of WordPress it is quite easy to expand the attachments fields using attachment_fields_to_edit filter, but in latest WordPress 3.5 RC2 it's not working. We can expand it using ...
1
vote
2answers
407 views

Change code to display image attachment page

I have this code which displays images with their captions in a list. On clicking caption, opens image in an attachment page, but clicking on image, opens that image with a dark-gray background. Is ...
0
votes
2answers
1k views

Get an image from url in front end submission form

I am building a user generated content sharing theme so how can i allow visitors to upload an image from a url i mean to say that they enter the url and the image gets automatically attached this is ...
0
votes
1answer
411 views

Attach images to posts using custom fields (just paths to images already upld)

I'm setting up a real estate website, which i make listings using a custom post type 'listings' in which I have multiples metaboxes for beds, baths, and all other informations. I use a plugin to ...
1
vote
2answers
1k views

Removing width and height attributes from wp-get-attachment

I'm using this http://www.ghosthorses.co.uk/production-diary/removing-inline-img-dimensions-for-responsive-wordpress-websites/ to remove the height and width attributes of images. Everything works ...
1
vote
1answer
3k views

Adding width and height to wp_get_attachment_image_src

I'm trying to add the width and height attributes to the wp_get_attachment_image_src. Why is this returning width and height:0? <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( ...
0
votes
1answer
554 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 = ...
3
votes
2answers
3k views

Set Featured Image Front Frontend Form

I have been struggling for days to figure this one out. I have successfully implemented a form to submit posts from the front end of my site. ButI can't figure out how to make the image uploads work. ...
1
vote
2answers
478 views

Wordpress Image Attachment using remote image

Is it possible to use remote image as wordpress attachment? * Not stored on our server.. How about the code/script? i see that attachment is act as post in database.. seems it's possible. UPDATE ...
2
votes
2answers
3k views

How can I export WordPress posts' attachments?

I am in the process of transferring posts from one WordPress install to another. I can use WordPress' Tools --> Export to export the XML I need for my posts. On the new install, I then use Tools --> ...
3
votes
1answer
251 views

Show Post ID in “Find Posts or Pages” box in Media Library?

In the Media Library, when I go in to attach a media item to a post, I know I can use "Attach" to pull up the "Find Posts or Pages" pop up. This brings the following list of post title, date and ...
3
votes
1answer
196 views

get post attachments of a particular size

Is there a good way to know if a post has an image attachment of a particular size? I'm trying to fetch 5 random posts, but I only want results that have image attachments with a (custom) size of ...
1
vote
1answer
2k views

Insert an image into a post by API

By using the code below, I can create a new post and upload an image to wordpress's upload directory as a attachment through a form's submitted data. $new_post = array( 'post_title' => ...
1
vote
2answers
217 views

Allowing post attachments without allowing to insert in text

Is there a way I can allow the user to attach images as attachments to a post without allowing him to insert them within the text itself? Ideally the Upload Media button remains the same but the image ...
1
vote
2answers
404 views

Disable edit media attachments?

Looking for a way to disable the "Edit Image" option. I would still like to be able to edit the description, alt, etc. But remove the Edit image button or disable that image editor. Thanks,
0
votes
1answer
169 views

Correct attachment size

I am trying using Really Simple slideshow with Wordpress and I am having issue while trying to retrive the correct image size for the slideshow. I am able to retrieve the first image without problem ...
1
vote
2answers
249 views

Getting the ID of any image for use in functions.php

I've added two custom fields to attachments on my site, so the user can add a special image credit. I'm trying to write a function that looks to see if either of the custom fields are populated, and ...
1
vote
1answer
153 views

problem in uploading attachment to custom directory

i have been trying to upload the attachments to the custom directory without affecting the old uploads. so i use this bellow code to achieve that add_filter('wp_handle_upload_prefilter', ...
0
votes
2answers
220 views

How to create an identical second loop for attachments?

I have one loop for big images, and I need the same loop with small images (thumbnails). This is where I am stuck. Use case: I am trying to implement the elastic image slideshow jQuery plugin with ...
0
votes
1answer
125 views

Random Characters in the end of every image url in post

I am having this strange issue, whenever a post is published the images url gets random characters in the end. i have checked teh functions.php but didn't find anything related. here is an example : ...
0
votes
1answer
539 views

Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?

Im looking for a way to add an alternating even/odd class directly to each image attachment when its outputted via my function below: <?php function nongallery_img_slide( $post_id = null ) { ...
1
vote
1answer
79 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?
0
votes
1answer
66 views

Create a permalink for a post's attachments

I'm trying to create a custom permalink structure. I'd like to have a custom page which displays each post's image attachments, using the following structure: www.mysite.com/hello-world/images If ...
-1
votes
2answers
371 views

Open attachments in new tab/window

I'm trying to make every attachment link open in a new tab/window but checking the 'Open link in a new tab' checkbox in the post editor or adding target="_blank" manually doesn't seem to work. Links ...
0
votes
1answer
138 views

Showing the attachment for a page?

I have the following function, it displays the attachments of a post, however it shows the full size, how can i show a limited number of attachments and also a smaller version like a thumbnail. ...
1
vote
0answers
211 views

Upload iPhone video clips to blog via native WP app

I'm using the WordPress iPhone app, and when I upload video clips to a blog they show up in some browsers and in others not. I'm using a HTML5 video markup as a container for the clips. While mpeg-4 ...
1
vote
1answer
81 views

How can I query posts with newly uploaded images?

I have a custom post type for events. A couple of days after each event photos are sometimes uploaded and attached to the event they were taken at. I want to highlight these image gallerys somewhere ...
0
votes
1answer
34 views

“After file loaded” action

I have a plug-in that allows for repeatable fields. There will be an image and the image description. The description allows for tinyMCE editing. There are obviously problems with this, but I think I ...
0
votes
1answer
249 views

Add File Attachment Name and URL into Javascript

I'm working on incorporating the jPlayer into our WordPress site. I don't particularly care for the two plugins that are available as our client is a bit on the technically deficient side. What we are ...
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: ...
0
votes
1answer
608 views

Contact Form 7 Data As Attachment [closed]

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 ...
-1
votes
2answers
180 views

Change the next thumbnail to text

Hey i am using this theme called starblog and on the single gallery page it shows this cpde below <div id="nav-images" class="navigation clearfix"> <div ...
0
votes
1answer
120 views

Images not being generated at correct size

I have my WordPress Media settings set like so. Based on these settings no generated large image should exceed the width of 540px. I embed an image in a post like so. I choose "Large" as a image ...
2
votes
1answer
108 views

Converting Attachment to Images?

I've had no problem using lightboxes before with attachment images, but I've switched to a new theme called Quicknote and it seems that attachment images now instead link to the attachment page. ...
0
votes
1answer
116 views

How to wrap this Link with an Image?

im working on default wordpress theme twenty eleven, i just wanted to know how can i wrap this previous and next anchor with an image or next/previous button? <span ...
1
vote
1answer
87 views

Add a term to an attachment submitted from front end

I have a front end post form where users can upload a file with their post that I save as an attachment using media_handle_sideload(). I need a way to add a term to that attachment so I can show a ...
1
vote
0answers
76 views

Regex to turn embedded images in to attachments

I've got a blog that has all images embedded in each post rather than a thumbnail linking to an attachment page which is what I'd like. I understand from this question that no plugin (like Regenerate ...
0
votes
2answers
152 views

Re-process Images

I've got a blog that has the highest-resolution version of all its images embedded in the posts, rather than a thumbnail linking off to an image attachment page. Can you tell me how I can re-process ...
0
votes
1answer
381 views

Help me fix these crazy attachment page URLs (rewrite?)

On one of my sites if a post's permalink is as follows: http://example.com/side-view-of-sheikh-zayed-grand-mosque-in-abu-dhabi-united-arab-emirates/ the attachment page for the thumbnail image ...
0
votes
1answer
176 views

is it possible to force wordpress to always save thumbnails as 'jpg' not 'png'

I cant see any settings and cant see much in the php api docs regarding this? for instance if the original file upload is a png wordpress converts to jpg
0
votes
2answers
132 views

How to allow empty title for attachments?

When adding an image attachment to a post, the Title field is always filled automatically with the file name. For some images I change this into something more meaningful, for other images I want ...
1
vote
1answer
118 views

media_sideload_image with rewritten urls?

When I try to use media_sideload_image with a path like this http://placekitten.com/300/200, it gives me an error. That is because it don't know the filetype or the filename. Best way to upload the ...
2
votes
1answer
280 views

query attachments of parent page if attachments of current page are smaller than …

I'm using WPQuery and get_children($query_images_args) to query attachments from the current page. If the current page has no attachments assigned I'm querying the images of the parent page. This ...
2
votes
1answer
2k views

what types of order can I pass to get_posts() via orderby?

Here describes get_posts() function. I would like to know what types of order can I pass to get_posts? in WP admin, I can see menu order, title, date, random and ...
1
vote
0answers
73 views

WP_Query Attachment adds additional attachment count and need to link attachment to post url

I just wonder why WP_Query adding one more additional attachment with the defined number or posts. Also need to link attachment (thumbnail) to the post url. Here is my code <?php $query = new ...
3
votes
2answers
372 views

How to set a default meta value for custom field

I have setup a custom meta_key for attachments. Since it is a radio button with Yes/No options, and the default value is always Yes, I need that this default value is saved into the db when the ...
2
votes
2answers
249 views

Find first image on paginated post for Pinterest

I've been looking for days, yet can't find a good answer. Perhaps the SE crowd can be of assistance. Any help is much appreciated. I am using a custom-coded pinterest button included on posts that ...
0
votes
3answers
198 views

WordPress Attachments vs Post Meta

Apologies if this is not a question and belongs more in discussion, but In dealing with image attachments for a portfolio site, what is the benefit to having images be "attached" to a post versus ...
1
vote
0answers
299 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 ...