WordPress core function to retrieve the attachment image (object)

learn more… | top users | synonyms

4
votes
3answers
722 views

How might I retrieve a featured post image from an external WP site and display it as a link back?

I have two WP sites. I want to reach from one of them, into the other, and retrieve specific featured images for posts, and display them with a link to that post. I am using this line (with the ...
0
votes
3answers
445 views

Display Gallery Images from Custom Post Type

I want to display all the images added as gallery in a post with prettyphoto class. I am using this code. <?php /* The loop */ while ( have_posts() ) : the_post(); ...
1
vote
2answers
425 views

Issue where WP Featured Image will not display

The code I'm using, is outside of WordPress i.e. define('WP_USE_THEMES', false); require('blog/wp-blog-header.php'); global $wpdb; The code that I'm trying to display the post thumbnail (the ...
0
votes
2answers
40 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
2answers
84 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 ...
0
votes
2answers
683 views

Get single image from custom fields made with WCK custom fields creator

I used WCK Custom Fields Creator to create a repeatable custom field for uploading pairs of images (one color, one black and white) to posts. So for example, one post may have three fields, with two ...
-1
votes
2answers
1k views

get_children - wp_get_attachment_image

I explain my problem: I create a post with an image get_children - wp_get_attachment_image functions returns that image I delete post image and add a different one get_children - ...
0
votes
1answer
44 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
1answer
261 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
1answer
115 views

Add anchor tag on previous_image_link / next_image_link

I am using big headers on my website.I need the next/previous_image_link to target to the picture , not the top of the page. Is it possible to add anchor or to set the target on ...
0
votes
1answer
423 views

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'oderby' => 'title', ...
0
votes
1answer
131 views

Why am I getting and error from wp_get_attachment_image_src?

This Code: <div id="canvas" class="plan-page" style="background-image: url('<?php echo wp_get_attachment_image_src( stripslashes($options['sitePlan']), 'full')[0]; ...
0
votes
1answer
141 views

How to retrieve “custom url” from image attachment in wordpress

I have uploaded a bunch of images to a post and set the 'custom url' for each of them in the media uploader. How can I retrieve the custom URL assigned to each image into $caption_text= at the ...
0
votes
1answer
221 views

Unable to get wp_get_attachment_url to show

I'm trying to show a link to the full size image of an attached image. I took a code for Wordpress' Twelve Thirteen theme: <?php $metadata = wp_get_attachment_metadata(); printf( '<span ...
0
votes
1answer
72 views

Retrieving Image Storage path

$attachment_id = 8; // attachment ID $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array Could you please specify which database table is referred for to retrieve ...
0
votes
1answer
121 views

Retreive tags from attached post for media on page

I am working on a custom template file that pulls all images in my Media Library with a specific tag. I was able to get this working with some help from the community, it also shows the title of the ...
0
votes
1answer
125 views

list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not

On single.php theme template file, I'm displaying the post's list of attachments. global $post; $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' ...
0
votes
1answer
129 views

Get a different size of Image thumbnail While working with custom metabox

I am using custom metabox for a page in my new project, I am using it for uploading image, and attaching it to the page. It's working fine, I can select image or upload the image using WordPress' ...
0
votes
1answer
120 views

setting featured image is not working while running script in background, works when running that script from browser

I have creted a script which will fetch content from one of my site and automatically create new post in my wordpress blog. When I am running that script from browser, its working really cool! post ...
0
votes
1answer
524 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
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
1answer
84 views

add_filter with specific thumb names

How would I run add_filter only on some specific registered thumbnail sizes '$size' ? like 'large' , 'medium', etc?
1
vote
0answers
68 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. ...
1
vote
0answers
60 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, ...
0
votes
0answers
23 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
22 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
0answers
16 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
22 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 ...
0
votes
0answers
19 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
0answers
54 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
0answers
30 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
0answers
11 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 = ...
0
votes
0answers
215 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
0answers
84 views

Some images not being returned with wp_get_attachment_image

For some reason this code works on my local copy of a wordpress site but the live site is not working. // WP_Query arguments $args = array ( 'post_type' => 'post', ...
0
votes
0answers
39 views

Incomplete attachment page

I am using the twenty-thirteen theme and my attachment page chops off the footer & image. Have a look at my screenshot. You can see that it shows the title but it doesn't show the image and the ...
0
votes
0answers
76 views

How to show post attachment image

i am going to create a slidershow by post attachment in single.php. i use this code but the result is null. <?php if ( have_posts() ) while ( have_posts() ): the_post(); ...
0
votes
0answers
323 views

I am trying to get metabox image with custom size

I am trying to get meta box image with custom image size. i used this code to get image but image is not displaying. <?php $img_src = get_post_meta( $post->ID, 'project_options', true ); ...
0
votes
0answers
44 views

wp_get_attachment_image_src match smallest edge

I'm trying to get the minimum image source that fills the given size. wp_get_attachment_image_src(get_post_thumbnail_id(), array(180, 180)) gets the image which fits the size and not which fills it. ...