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
241 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
809 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
85 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
115 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
1answer
358 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
199 views

Problem attaching image to a wpec product

I'm having a problem with WordPress not finding all products (wp ecommerce) but just variations of products when you attempt to attach an image to a product in the media section of the backend. It's ...
0
votes
1answer
125 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
124 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
64 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
73 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
1answer
1k 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
783 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
220 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
250 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
161 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: ...
1
vote
4answers
5k 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
856 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
148 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
372 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
214 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
206 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
66 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
388 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
268 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
223 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
252 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
163 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
226 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
494 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
522 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
523 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
3k 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 ...
17
votes
1answer
3k views

How to manage attachment relationships for specific posts in WP 3.5+

In WordPress 3.5, media management has changed entirely. Also, relating attachments to specific posts is (I believe) basically only being done for backward compatibility. Therefore, after uploading ...
1
vote
1answer
449 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
1k 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
357 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
888 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
296 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
782 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
2k 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
398 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
1answer
2k 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
330 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 ...
1
vote
2answers
2k 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
215 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
147 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
1k 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
208 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
1answer
280 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,