WordPress core function to retrieve the attachment image (object)

learn more… | top users | synonyms

0
votes
1answer
22 views

Get attachment images does not return any attached images

According to WP codex the code copied below will return a list of images attached to a "page". I have yet see this happen and I'm at a complete loss as to why: I have created a template page called ...
0
votes
1answer
83 views

Getting the image title/alt attribute from the gallery shortcode

I am trying to learn how to code php so that I can customize the image gallery within WordPress (among other customizations). The code I have works great for a stylized gallery page, but having a ...
1
vote
0answers
30 views

Show image EXIF info

I am working on image gallery site. On test site (which is on shared hosting) I created and tested theme and plugins. I know that WP store some extra info about image during image upload (EXIF/IPTC ...
0
votes
0answers
20 views

Why will featured image show on some pages but not on other pages using the same template?

Why do some pages have a functioning featured image showing in the sidebar while some pages with the same template and even with the same image don't show the featured image in the sidebar but still ...
0
votes
0answers
50 views

Working with gallery shortcode and get gallery images

The only way I've been able to get the "current" gallery images from a post has been through "if has_shortcode" and checking for a gallery and getting the gallery images. In this way the client can ...
1
vote
1answer
134 views

Understanding and altering the structure of posted images

Currently this is the (default) Wordpress image output: Float left, with caption, link to img <figure id="attachment_10220" style="width: 167px;" class="wp-caption alignleft"> <a ...
0
votes
0answers
10 views

Why WordPress attachments LINK TO settings are not working?

Using this code below, I added some on-hover share icons for all images of the content. But, now these images are not getting any "Link To" setting from authors. I don't know what is the problem. Can ...
0
votes
1answer
42 views

Hide Image Container if No Image Attachments

I have a CPT that displays any attached images via a slider. However, when there are no attached images the slider still appears. Is there a way to add a conditional IF statement that will hide the ...
0
votes
1answer
22 views

Get attachment/image info in JS

Is there a specific method to get attachment/image info in JS? I have an attachment id and before I use any add_action("wp_ajax_get_image_info", "get_image_info"); I would like to see if there is ...
0
votes
2answers
37 views

How do I get the URL of a specific size featured image?

I am using <?php wp_get_attachment_thumb_url( $attachment_id ); ?> to get the url of a thumbnail for a post in Wordpress. However I would like to retrieve the URL of a specific size image. So ...
0
votes
1answer
100 views

Function to get custom post image URL

I have to retrieve the URL from a custom post image, just the URL, like: http://example.com/wp-content/uploads/blablba.jpg. The code which I have to filter is this: <?php cp_get_image_url(); ...
0
votes
0answers
262 views

Previous and next posts with images on attachment page (image.php)?

Show two previous, current and two next posts with post featured images and links to previous and next post on attachment (image.php) page? I have image gallery site and that kind of navigation is ...
1
vote
1answer
246 views

Having Problem On Getting WP Post Gallery Images URL

I need to get the URL (actual Size) of all images of gallery associated with a post in single.php. The following code from Codex returns all images in very small size 150x150 which is not suitable for ...
0
votes
0answers
35 views

Issue on Getting WP Gallery Items In cpt-single.php As Attachments

Having a "Custom Post Type" called Projects I am trying to get actual URL of images added into Post Gallery and list them in class other than WordPress built in .gallery. This is the code which I ...
0
votes
1answer
107 views

getting attachement images src and add classes

I have posts whose each contains 4 attached images. what i'm trying to do in my single.php is to get all the 4 images src to be abble to add different classes to each images. <img class="image_1 ...
0
votes
2answers
67 views

Setting featured image based on related post

I am using a plugin called The Events Calendar. I don't always set the featured image for each individual event. Each event has an organizer ID (tribe_get_organizer_id). I want to add a filter that ...
0
votes
0answers
110 views

Changing attachment url?

How to change default attachment url: www.domain.com/category-name/subcategory-name/some-post-title-here/attachment/some-post-title to: ...
0
votes
1answer
172 views

Display custom gallery in each wordpress post

In my website there is post thumbnail slider. Post thumbnail slider will show images related with blog post. I want when we write any post then it will allow me to upload few images via media uploader ...
0
votes
1answer
168 views

Display all attached image of every post of custom post type and link to original post

I've written a loop that displays all the images that are attached to every single post of a specific post type. The post type is called "atls_events" and I'm outputting an image size called ...
4
votes
2answers
201 views

Check if post has attachments (not image)

Need to do a check if post has attachments that are not images. I haven't seen this anywhere - thoughts?
0
votes
0answers
128 views

Change default URL of image attachment

I have only one image attachment per post, as featured image. Every post have just one image, featured image, and no any other image in post content. By default URL of image attachment is: ...
0
votes
0answers
76 views

Filter wp_get_attachment_image

I'm working on a new WordPress plugin, that will have to change the media library directly. For that I have to overwrite or filter the wp_get_attachment_image function, that class-wp-media-list-table ...
0
votes
1answer
64 views

Why this thumbnail hard crop code does not work?

I am trying to show thumbnail image as an attachment in the feed. So I use following code. function add_images_to_rss($var) { global $post; if(has_post_thumbnail($post->ID)) { ...
0
votes
2answers
282 views

upload images on front by user using form

I'm using a form on my website using wordpress to allow users to create posts. It works perfectly fine, I'm abble to assign the posts to a custom post type, add Advanced Custom Fields, content, ...
0
votes
0answers
24 views

Add the title of an image to the image link into a post

i have a simple question. I have a page of wordpress site where i have insert image that link to "file media". I use shodwobox.js plugin to display the images. i have use this code to add ...
0
votes
0answers
73 views

Special characters in image url stripped out with wp_get_attachment_url

I've got a plugin I'm working on and I need to access an attachment image. I've been using either wp_get_attachment_url() or wp_get_attachment_image_src() to get the slug for the image. It's been ...
1
vote
1answer
90 views

Set the background to a default image if there isn't a specified “featured image”

I am having a little trouble displaying a default image as a background image when a feature image is not present. This is the code I am using <?php if (has_post_thumbnail( $post->ID ) ): ...
0
votes
1answer
359 views

wp_get_attachment_image_src() returning incorrect width and height [duplicate]

I am trying to return the src, width and height of a cetain image: $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); This is returning the expected array but with incorrect ...
1
vote
1answer
54 views

How to add an image for unit testing?

I have to test the function where it calls wp_get_attachment_image_src. How do I add an image for testing, because right now if I call this method it returns false.
0
votes
1answer
345 views

Making images from single.php pointing to an attachment .php template

I am trying to make the inserted images from a post (single.php) to point to (single-attachement.php) an attachment page. So far I checked a post here on stackexchange and added this code on the top, ...
0
votes
0answers
29 views

Adding Image input to a plugin post

Here is my problem. I have a plugin running in my wordpress site that posts a person biography. It is designed so that the image for the biography is inserted with the content. I want a specific ...
0
votes
1answer
149 views

echo image caption

I am attempting to echo out my image captions in a Bootstrap Carousel. I have managed to get my images to display but unable to display my captions. I have attempted to use wp_get_attachment_metadata ...
0
votes
1answer
36 views

Open image size links in a page instead of direct image link

I am using this custom function to display image sizes on image.php (attachment page) function my_get_image_size_links() { /* If not viewing an image attachment page, return. */ if ( ...
0
votes
0answers
158 views

wp_get_attachment_url returns wrong file name

I just spent the past hour trying to find a topic relating to this. I must be doing something really stupid and I don't know what it is. Basically, my problem is that, after being uploaded, images ...
0
votes
1answer
128 views

wp_get_attachment_image_src always returns false

I'm using wp_get_attachment_image_src to retrieve image URL. Codex is simple for this function and starting from an ID on my database I used wp_get_attachment_image_src in this way: $image_url = ...
0
votes
0answers
45 views

unable to access image attributes in wp_postmeta when looping through posts

I have an issue with accessing attributes of a library image, particularly the "Alternate Text" attribute. I use the ACF (Advanced Custom Fields) plugin to pull back the slideshow image which is ...
0
votes
2answers
259 views

Multiple instances of Featured Image Thumbnail As A Background On Homepage

Here's what I'm trying to do: Make it so the first 6 posts are displayed differently on the homepage than posts 7 and on. The first six posts should grab their featured thumbnail images and use them ...
3
votes
1answer
659 views

How to add a “data-” attribute to the image tag of native gallery output

While trying to make WordPress and Galleria to become friends I already have a good result. Galleria can easily be used to display native WordPress Galleries. I'm using a plugin but that's not ...
1
vote
0answers
96 views

frontend image post uploader

I've set up image uploader on front end custom form for users with some text input, textareas etc .Everything works fine, untill I decide don't upload any image. Then my "thank you" page gets blank. ...
0
votes
0answers
12 views

Is there easier way not to display all images attached on the page from media?

I'm thinking not to delete the images I attached on the page, but will just have conditions not to display images with order set to 0. If I have code like this: $thumbnail_ID = ...
1
vote
1answer
400 views

How to get media objects

I am busy with a loop to return all media in the medialibrary in objects. I figured out how to get the images ( with wp_get_attachment_image('$mediaID') where the $mediaID is the id of the image ) ...
0
votes
2answers
710 views

How to make Next and Previous attached image navigation on the attachment page? [duplicate]

How to make Next and Previous attached image navigation on the attachment page? ' . __( 'Previous Image', '$text_domain' ) . '' ); ?> ' . __( 'Next ...
0
votes
1answer
57 views

Why can't I display attachment_image_src with Custom Size?

I'm trying to display an attachment with a custom size that I created with add_image_size called "custom-size-01" What the code returns is the word "Array" I've looked at the wordpress reference and ...
0
votes
2answers
184 views

wp_get_attachment_image_src returns image on main domain, false on subdomain

I've got a multisite install in development where both the subdomains and the main site use the exact same page templates for showing data. However, when I try to get a profile image (added ID in ...
0
votes
2answers
135 views

How to check if there is image title, caption, description?

I use this code to display featured image title, caption (excerpt), description (content): echo get_post(get_post_thumbnail_id())->post_title; echo ...
0
votes
1answer
561 views

Get the size (size in Kb or MB) of an featured image?

I need to display some featured image info on post page. Among other info I need to display file size of image (featured image of post). I tried this function inside single.php. <?php function ...
0
votes
1answer
447 views

Display featured image file size, extension, filename, type, orientation?

How to display some information of featured image in post. I need to display: 1. a. Image file size (in kb or MB) b. Image type (.jpg,.gif...), c. Bare image name, with and/or without image ...
0
votes
1answer
374 views

Change attachment inside the_content using filters

I am in search of a snippet or function that will filter the embedded images inside a post to a custom size I have defined in functions.php. Here is the scenario: A client uploads and add any ...
0
votes
0answers
299 views

ACF Gallery insert from URL

Have built a gallery using Advanced Custom Fields (ACF) and Flexslider. The slider and images display correctly using the ACF code below. As most of the images will be hosted else where (on an other ...
0
votes
1answer
843 views

Get the URL, width and height of an image where the width and height are a specified minimum

Is it possible to get the URL, height and width of an image where the height and width are as a minimum the size I specify? wp_get_attachment_image_src() almost does this, but not quite, grabbing ...