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

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
31 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
234 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
96 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
61 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
56 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
924 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
142 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
64 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
145 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
610 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
64 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
176 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
77 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
516 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
123 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 ...
3
votes
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
204 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
175 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
54 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
152 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
262 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 ...
1
vote
0answers
98 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
130 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
1answer
331 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
114 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 ...
2
votes
1answer
393 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 ...
0
votes
0answers
369 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 ...
1
vote
2answers
307 views

Moving 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
455 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 ...
2
votes
1answer
29 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
210 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
48 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 ...
0
votes
0answers
66 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
100 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
269 views

Upload unnattached image from frontend

I am using the below function to let users upload files from the front end. It works great except that I would like the file to NOT be attached to any post. Currently, the file is automatically ...
-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
210 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
552 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
2answers
761 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 ...
2
votes
1answer
195 views

Rename attachments during upload

Here's the function I use for WP to rename images during upload on the fly and set the image's filename to match the post slug. function wpsx_5505_modify_uploaded_file_names($arr) { // Get the ...
0
votes
1answer
153 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 ...
0
votes
1answer
172 views

Import Dummy Content and Post Thumbnails

I am setting up a small dummy content plugin. What I would like to do is import several posts using wp_insert_post. Then I would like to import several images using wp_insert_attachment and then ...
0
votes
1answer
126 views

Hiding or removing file extension displayed in HTML on attachment page

I’m doing up a photography theme in WP at the moment, and I’ve already got great help on this thread (thanks Milo!) for a previous question. In that thread, I asked about displaying the file name of ...
1
vote
2answers
325 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 ...