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

Will wp_get_attachment_metadata display PDF metadata (eg: keyword, author, description)?

I used this technique to display attached PDF metadata on a page. It shows the title and path but not info like keyword, author, and description. Can Wordpress access all the properties uploaded with ...
0
votes
2answers
259 views

List Wordpress Post and Related Attachments outside of a post page

I've been having difficulties with some new functionality I've been trying to create. Basically I have a custom page setup that displays a list of all posts with a specific tag. What it needs to do is ...
0
votes
1answer
136 views

Is there a way to show attachment IDs on the attachment info screen?

I want to use attachment IDs for shortcodes, but if the image is published with a permalink, it's harder to find the ID. I've found some functions online that can turn the attachment url into its ID, ...
0
votes
2answers
485 views

Can't sort get_posts by post_mime_type

I'm trying to run a query to get all attachments and I'd like to sort by the post mime type. This query isn't working. Any ideas? $query_args = array( 'post_type' => 'attachment', 'numberposts' ...
1
vote
1answer
828 views

Custom page template to display all image attachments

I am tryin to insert all pictures in media to page. By meaning all pictures, everything added in blog. I ve been looking this feature all day. Is there any shortcode for that or something easy to make ...
0
votes
1answer
582 views

orderby not working for query_posts using array of IDs

I have an array of IDs that i send to query_posts to get the posts (which works fine) but it seems to always put the attachment(562) last even though it is the newest. Also tried title and ASC vs DESC ...
0
votes
1answer
143 views

Excluding post thumbnail from the attachment.php when using wordpress gallery

I am looking for this answer everywhere and can't find it. I setuo the wordpress default gallery using the attachment page which shows next and previous photos. everything is working fine and I have a ...
1
vote
1answer
288 views

How would one change the default url structure of attachments?

When I click on post images it redirects in a page with a url like this: http://localhost/?attachment_id=897. Can I set the default image link like http://localhost/wp-content/uploads/2012/05/dice.jpg ...
2
votes
1answer
770 views

Link Featured Thumb to Attachment Page, If Possible

Are featured thumbs uploaded the same as other images and have their own attachment post url? I'm trying to utilize the 3.0+ post formats and am using the featured image when creating a post under ...
2
votes
4answers
3k views

get attachments for all posts of particular post type

I'm making a widget that shows a set of images from recent custom posts. I want to run the following query: SELECT p.* FROM wp_posts p WHERE post_type='attachment' AND post_mime_type LIKE 'image%' ...
0
votes
1answer
354 views

SQL: Search query to get attachments only of those parents which are published

i'm having some problem creating nice 1 query to be able to get search results which includes NOT only post_type POST but also attachments. BUT if search query return attachment, i want that it won't ...
1
vote
1answer
1k views

Get post attachment images dimension and use in embed code

I am trying to make things work like where any post attachment image will generate embed code automatically. Example: If I upload and add two images 1. 250x150 2. 600 x 160 and insert into post. Now ...
-2
votes
1answer
65 views

How can we see which posts don't have a featured image or it doesn't exist anymore?

Which plugin or code I need to make it show me a list with the posts that don't have featured image or is broken(the featured image doesn't exist anymore)?
1
vote
2answers
343 views

Validate data on attachment_fields_to_save

I'm very glad that there is such a dedicated website for WP. My problem is data validation upon saving attachment fields. I have added many custom fields to attachment/media library dialog, most of ...
1
vote
1answer
405 views

Set attachment tags from attachment's custom field data

I currently have a custom field added to my attachment's form called artist_credit using the hook attachment_fields_to_edit. When a person enters a name into the artist credit field, I want it to (if ...
3
votes
1answer
1k views

Uploading Multiple Attachments From Front-End With A Description

I am working on a Wordpress site that has a custom front-end submission form for adding in a post of content type, 'sketchpad'. The form has a section that allows you to upload multiple images with a ...
-1
votes
1answer
142 views

How can I attach files without using a plugin?

I want to add files from my site or from external links with files to any of my posts, and be able to add the size of the file and choose which ones it will do "File Force" and which not. I want to ...
3
votes
2answers
2k views

wp_generate_attachment_metadata gives me an empty array

I have a custom post type and a metabox with a file input. I can insert the attachment, but I can't update the attachment metadata and I don't know how to fix it because I don't receive any error. ...
1
vote
1answer
618 views

How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?

I'm developing a simple "member's only" section within a website, with the sole intention of allowing the client to post files for their members. I've come to realize quickly that the posts' ...
0
votes
1answer
596 views

How to hide image-url if no attachment?

How can I hide the img-tag if there is no attacment? (function is from this tutorial: http://wp.tutsplus.com/tutorials/automagic-post-thumbnails-image-management/) <img src="<?php ...
0
votes
2answers
348 views

filter get_children to return all mime types EXCEPT 'x'

Like it says on the tin - Im trying to create a list of post attachments that includes everything except say audio, which I'll feed into a player instead. The filter needs to be generic: 'audio' ...
2
votes
2answers
617 views

Getting ID from ajax response of async-upload.php

Its a wordpress+jQuery question. Can't post it on stackoverflow because i believe it involves wordpress knowledge too. What I am trying to achieve: I am attaching the wordpress async media uploader ...
0
votes
1answer
223 views

Display a post attachment depending on the caption

I would like to display automatically a post attachment (PDF) depending on the language of my blog (french and english). When the post is displaying in french version, I would like display the french ...
0
votes
2answers
684 views

How to get thumbnail from post attachment in this loop

I use this code to display Most popular posts based on view count, but I dont have images in post content I have all images attached to post via attachment (gallery) How to replace this "thimthumb" ...
2
votes
2answers
407 views

Converting a simple plugin to be placed inside of functions.php

First off, I know it's better practice to use plugins separately than to integrate them in functions.php but this is for a theme framework that will be deployed to multiple sites and it will be easier ...
0
votes
2answers
2k views

Media is not attached after import

I am new there and I need some help for importing a wordpress blog. I have a old wordpress 3.1 blog (no multisites) and need to move to new hosting (a sites under multisites). I don't have the access ...
0
votes
1answer
221 views

How d0 i get the number of attachments in the post

Is there a function that allows me to get the number of photo's attached to a post and that also grabs the url of the first attachment to go to the attachment page for each post? Here is an example ...
0
votes
1answer
407 views

How do i save and retrieve custom attachment meta?

I'm trying to save if a checkbox inside of the media uploader pop up is checked, so i can retrieve it from the front end. I'm using this code: function filter_attachment_fields_to_edit( ...
1
vote
1answer
887 views

why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?

I am using a new blog on WPMS (3.0.1, updating is not an option) to aggregate posts (and their featured image) from a few blogs on the same install, and I have to do it programmatically rather than ...
0
votes
1answer
397 views

How to fetch only media that was already attached to a post/page?

Situation: my client has this simple gallery built with WP_Query showing the latest media added to the site: $cola = new WP_Query( array( 'post_type' => 'attachment', 'post_status' ...
0
votes
1answer
2k views

Getting attachment post using wp_get_attachment_link

The WordPress codex on wp_get_attachment_link says you can use the $permalink parameter to link to the page, not the image. But I would like to link to the post instead. I'm trying to get a list of ...
1
vote
3answers
3k views

use wp_get_attachment_image() to show attachments

I really hope this is a facepalm moment, b/c i'm getting frustrated with this. Making a quick loop to show certain attachment images. lifted it almost straight from the codex but ...
0
votes
2answers
399 views

custom url - add attachment's id or name after post

I want to link to attachments but through its parent page. /directors/piranha-bar/ shows all of that post's attachments on single.php and i want /directors/piranha-bar/video/name-or-ID/ to still use ...
1
vote
1answer
425 views

Exclude images from “inserted into post” when trying to get attachments

I have here the coin-slider which takes all pictures from the gallery. I get the attachments through the following code: $attachments = get_posts(array('post_type' => 'attachment', 'post_parent' ...
1
vote
2answers
221 views

How to set a conditional statement for $attachment->post_excerpt, to check for value?

I have a custom function which looks if an attachement has a certain caption value, if so the attachement is selected, like so foreach ($attachments as $attachment) { if ...
0
votes
1answer
59 views

Building custom pages with a video player

Hey i am trying to learn wordpress developement on my own, I'm building a celebrity gossip blog and i need help. I want to build a video page. Does anyone know of a plugin or anything that i can ...
0
votes
1answer
801 views

Post Gallery list attachments except the one used as post thumbnail

I'm doing gallery in a single post after the post thumbnail. So I list all the post attachment with the image type (with the following query) but I want to exclude the post thumbnail. global $post; ...
0
votes
2answers
2k views

How do I get just the title from wp_get_attachment_image

I can get the image to appear fine in this bit of gallery code. However the flex slider gets its caption from a <p> tag (class="flex-caption") and I just need to echo out the image title inside ...
0
votes
1answer
85 views

How can we select attachements based on Caption?

I am trying to select some attachements based on an attachement caption. I need to do this for a seperate download page. On the download page i want to display all attachment which caption equals ...
2
votes
2answers
3k views

Find the post an attachment is attached to

I have a list of attachment IDs which are built using this array: $all_images = get_posts( array( 'post_type' => 'attachment', 'numberposts' => -1, ) ); Is it possible to take the image ID ...
1
vote
2answers
681 views

How do I permanently Disable Attachment Post URL

How can I get rid of the attachment URLs completely? I don't want users to have the ability to link an image to the Attachment URL when inserting an image, ever. I've done things in the past like ...
1
vote
2answers
993 views

Show Multiple Size URL of one Featured Image/Thumbnail?

Is it possible to print two different url's from the same featured image/thumbnail? So i have set up my image size.. add_image_size( 'full-size', 460, 9999 ); add_image_size('fixed-height', NULL, ...
1
vote
2answers
1k views

How do i show wordpress attachments from current post?

So with my blog i have a photo attachment page but it only shows to photo's at a time, and those two photo's are used as the navigation and i hate that. I want the attachment page to show all the ...
0
votes
2answers
883 views

How do i add LIGHTBOX to Attachments?

How do i add the light box function rel="lightbox" to the code below <a href="<?php echo wp_get_attachment_url($post->ID); ?>" title="<?php echo wp_specialchars( ...
1
vote
1answer
280 views

Sorting By Custom Posts With Attachments

I think I've got this figured out and I'd like to make sure I'm not missing anything obvious. My goal is to prioritize a list of results by custom posts with attachments. So, I have a query returning ...
1
vote
1answer
45 views

Is there a plugin which allows me to save additional, invisible content per post?

For a blog project, I need to be able to attach content to each blog post which isn't visible to the casual reader but to all editors. Think of it as a collection of reference materials, comments and ...
1
vote
3answers
2k views

Add multiple images to a page sidebar

What I am trying to achieve is this: I have a simple page and I want to dynamically add multiple images to it on the sidebar one underneath another. I was thinking about either using meta boxes, post ...
2
votes
1answer
352 views

Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory

I have a bunch of old posts on a blog that I would like to assign a featured image to. I have retrieved all the images I would like to use for each post. I saved each image file name after the slug ...
0
votes
2answers
136 views

Moved server, and WP now uses original images for all thumb sizes?

I just moved servers. When calling wp_get_attachment_image() or any of its sister functions the image returned is always the full-size image, scaled down, instead of the requested thumbnail size. ...
0
votes
1answer
103 views

Stop Attachment image names from taking top level permalink

I don't know why but images uploaded to my site in posts are getting a top level permalink. So if I upload an image into a post called "Apple" then it gets an attachment page at mysite.com/apple and ...