1
vote
2answers
33 views

How to add a rel attribute to images that contains their categories?

I've added categories to images, so that I can use them to filter images within a portfolio page. Now I'm thinking I need to add the rel attribute to each image that contains its assigned categories. ...
3
votes
1answer
61 views

How to add classes to images based on their categories?

I need to be able to: 1.) assign categories to images and 2.) add classes to all images that correspond to their assigned categories. I was able to add categories to images with the following: ...
1
vote
1answer
46 views

How to add a class to the attachment images

When I'm in the Wordpress editor and I add an external image with the 'img' button, my html result wil be like this: <img src="http://example.com/image.jpg" alt="image" /> How can ...
0
votes
0answers
12 views

Presetting the link of video attached to a Standard Post Format in a custom field

I am trying to create a function that presets the URL (of an attached video in a Standard Post Format) to a custom field when the post is created using a front-end form. (P.S.: All data inputted in ...
0
votes
1answer
225 views

Get ID of first image attached to a post

I'm looking to find a solution that enables me to get the ID of the first image attached to a post in the loop. I'm currently using this; $size = 'post-thumbnail'; // Define image_size to be used ...
0
votes
1answer
454 views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
3
votes
1answer
158 views

Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?

I am looking for solution to auto delete images of old posts in WordPress site. I want to hold images of current 50 posts, others should be deleted automatically. It can be function to delete on time ...
0
votes
0answers
374 views

Set thumbnail from URL, by grabbing image in functions.php

So I've written a whole bunch of functions, which are used to display Vine videos. I then have a shortcode which outputs the code. The last thing I have to do is set the post thumbnail. I want to be ...
0
votes
1answer
482 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 ...
1
vote
2answers
289 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
vote
2answers
225 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 ...
2
votes
2answers
234 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
1answer
599 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 ...
2
votes
2answers
410 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
1answer
223 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
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 ...
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 ...
2
votes
1answer
353 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 ...
1
vote
1answer
272 views

What is the “icon” parameter in wp_get_attachment_image_src used for?

On the reference page for wp_get_attachment_image_src, there is a parameter called icon and it only says: $icon - (bool) (optional) Use a media icon to represent the attachment. Default: false ...
2
votes
2answers
2k views

delete post also attachments

I am trying to delete a post with its all attachments. This is the function that i came up with right now; function remove_post(){ if(isset($_POST['post_id']) && ...
5
votes
1answer
4k views

remove links from images using functions.php

I am looking for a way to remove the attachment link from images in the post content. I would like to add this to the functions.php in my theme. I know you can disable this in the post on a per ...
2
votes
2answers
533 views

Best way to programatically add “rel” attributes to page and post images

For single posts and pages, I would like to add certain rel attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be ...
1
vote
1answer
490 views

Can't filter wp_get_attachment_link

Can't figure out why this won't work: function my_get_attachment_link($html){ $postid = get_the_ID(); $html = str_replace('<a','<a rel="shadowbox['.$postid.']"',$html); return ...
0
votes
1answer
3k views

attachment page template? only show attachments for current post?

hey guys, didn't know that, but the attachement page (i'm using attachment.php as template) is actually looping through ALL ever uploaded attachments to my blog! I just want to use it in order to ...
1
vote
2answers
2k views

page template for attachement page?

hey guys, I couldn't find anything on the web. Is it possible to have custom template for the image attachement page. I wonder if it is possible to add a navigation to the image attachement page so ...