Linked Questions
19 questions linked to/from Turn a URL into an Attachment / Post ID
4
votes
1
answer
8k
views
Get Attachment ID from URL [duplicate]
I have the URL of an image which I know is an attachment. Now, I need to find out the attachment ID.
This is what I've got (thanks to PippinsPlugins):
// retrieves the attachment ID from the file ...
8
votes
6
answers
35k
views
How do I get attachment_id?
This is trivial, but I can't really find an answer, I've seen some hints like search in database etc., but this is madness.
Basically, I have a metabox with upload button that allows you to upload or ...
2
votes
2
answers
4k
views
Get attachment id from WP Customizer
The WP Customizer's WP_Customize_Image_Control returns the attachment's URL, but I need the ID because I want to output the image like this:
echo wp_get_attachment_image( $user_logo_id, 'riiskit-user-...
17
votes
3
answers
513
views
Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)
I am currently in the course of migrating site content from an old pre 4.1 site to a new setup and hitting an issue with the rounding error issue of #18532 and the corresponding fix.
To summarize this ...
2
votes
1
answer
5k
views
Set featured image using URL with wp rest api
I'm using wordpress REST API for sending posts. I uploaded the media already on the wordpress and i have the urls, now I want while sending the post request for creating a post, i could give it the ...
3
votes
3
answers
3k
views
Reducing image size in RSS only
Is it possible to reduce the image size of WordPress rss feeds parse to feedburner?
Meaning to say I still want to retain the large image size on the original post page but only display the ...
0
votes
2
answers
2k
views
If file exists with page slug name show image else nothing
I need to add a php code in a wordpress widget called PHP Code Widget which only asks for proper enclosing:
All PHP code must be enclosed in the standard php opening and closing tags ( <?php and ?&...
0
votes
2
answers
2k
views
Retrive images from the_content()
I would like to get the images from the_content(), I know I could use a regex to get the images but I wanted to know if there is any other more 'wordpress way' for doing this?
I have this within a ...
0
votes
0
answers
2k
views
Get video attachment ID and display length
I need to show length of a video attachment.
Video is in media library. I put the video normally, by wp administration.
I am using this code in content.php, inside the loop, after this:
<?php ...
2
votes
1
answer
2k
views
Replacing with(out) regex link to attachment by links to files
I tried to do it myself but I have really hard time with Regex (regex is hell. I just don"t understand).
Anyway, I think this would be usefull to some people. The context is that we use a plugin to ...
3
votes
1
answer
960
views
Generating Responsive Background Image Sizes in PHP
Im trying to generate responsive background images for my page header, using a modified version of this gist, but I cant get it to work correctly, and Im not sure if the issue is with ...
0
votes
1
answer
1k
views
get_post_meta image width for lazy load
I'm trying to lazy load a page of images in Wordpress - I've tried the plugins but none of them seem to work(I only want to lazy load image on some pages.)
So I'm now trying to do it with a plugin - ...
0
votes
1
answer
857
views
Is it possible to get feature image url (full-size) from an image url of smaller size?
Supposing that we know nothing except the url of image (smaller size e.g. 150x150)
http://xxx.com/wp-content/uploads/2014/06/test-image-150x150.jpg
What is the best way to get its full-size image ...
0
votes
1
answer
298
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
1
answer
286
views
Save attachment ID instead of URL in custom field
I am testing several frameworks (currently Vafpress) to help me creating custom meta boxes. I need to save a lot of attachments with my posts but noticed that the attachment is saved with its full URL,...