The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
3k views

wp_get_attachment_image_src() does not return what I want

I got this annoying issue I can't solve : if( $meta1 = '' && $meta2 = '' ) { $image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), my_own_size_function()); ...
0
votes
0answers
41 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. ...
0
votes
1answer
155 views

How to get the id or url of the image in an image post?

I have a bunch of image posts and I'd like to get the ID of those images I didn't set a featured image so I can use wp_get_attachment_image_src() to get the urls of various sizes of those images. ...
0
votes
1answer
125 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
118 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 ...
-1
votes
2answers
183 views

Display Images from Array with wp_get_attachment_image() [closed]

I'd like the client to be able to type any image ID (number) from any gallery / attachment and then displaying it with wp_get_attachment_image(). Here is my code: if ( $images ) { foreach ( ...
2
votes
2answers
664 views

replace wp_get_attachment_image with my own function

How can I replace wp_get_attachment_image() function without changing the core files. The function doesnt have an action hook or a filter hook. What I am trying to achieve: for lazyload plugin ...
0
votes
1answer
501 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
187 views

File format of post image attachment

I'm working on a website that can display 3D molecules (.mol) using the JavaScript-based viewer from JSmol (http://sourceforge.net/projects/jsmol/). With the "Upload File Type Settings" plug-in files ...
-1
votes
2answers
911 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
124 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
47 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
171 views

Better wordpress attachment query then this

I have a site with more then 10.000 posts and images, its classipress site. I need somehow to show all images from posts that are on pending status, and who havent expired(post meta). This is the code ...
0
votes
1answer
763 views

wp_get_attachment_image_src returns incorrect URL on multisite

I'm not sure how much code to post because I don't think too much is relevant. I'm just dumping the contents of wp_get_attachment_image_src and the contents turn out to be incorrect on multisite. ...
4
votes
3answers
640 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
1answer
384 views

Get author custom image field URL to display on post page?

I'm using advanced custom fields and have setup an image field for my users to add an image in their profile. I'd need to display this image on post pages, so i've tried the following... <?php ...
1
vote
1answer
2k views

How to add image attachment to post from a single meta key (Woocommerce)

I'm using Woocommerce for products. All products are imported automatically by a plugin. Currently when i want to attach an image to a product (a post type) i have to use "Featured image" to display ...
0
votes
1answer
595 views

How to get the next and previous image title from attachment or gallery?

I'm trying to build a slider exactly like this in wordpress. I have managed to make the slider work except the next/prev button. I need to get the next image title and the previous image title for the ...
0
votes
2answers
2k views

How to get custom image field of specific post id

I have a page where I'm pulling in content from another post, outside of the loop. I've been successfull at getting the content of the specified post, but I cannot get the image from a custom field ...
1
vote
3answers
729 views

change wordpress gallery shortcode to slider

Hi I wanted to change the default WordPress gallery short-code and make it a slider. remove_shortcode( 'gallery' ); function gallery_filter( $atts, $content = null ) { ...
1
vote
2answers
397 views

Change code to display image attachment page

I have this code which displays images with their captions in a list. On clicking caption, opens image in an attachment page, but clicking on image, opens that image with a dark-gray background. Is ...
0
votes
1answer
608 views

Attachment image single page

How do I make a single post page for a single attachment image below and link to it? <?php get_header(); ?> <div id="body"> <?php if (have_posts()) : ?> <div ...
1
vote
2answers
413 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 ...
1
vote
2answers
1k views

Removing width and height attributes from wp-get-attachment

I'm using this http://www.ghosthorses.co.uk/production-diary/removing-inline-img-dimensions-for-responsive-wordpress-websites/ to remove the height and width attributes of images. Everything works ...
1
vote
1answer
3k views

Adding width and height to wp_get_attachment_image_src

I'm trying to add the width and height attributes to the wp_get_attachment_image_src. Why is this returning width and height:0? <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( ...
0
votes
2answers
712 views

Remove height attribute from wp_get_attachment

I found this great solution: Stop wordpress from hardcoding img width and height attributes But I was wondering if I could do it only in one specific case and not in all the site because it messes up ...
3
votes
1answer
188 views

get post attachments of a particular size

Is there a good way to know if a post has an image attachment of a particular size? I'm trying to fetch 5 random posts, but I only want results that have image attachments with a (custom) size of ...
1
vote
2answers
2k views

Add Download Button in prettyPhoto Plugin

I would like to add a download button link for the full-sized image on the prettyPhoto lightbox when a user views a photo on my site. Currently I use the prettyPhoto Media plugin on my site, and I ...
0
votes
1answer
169 views

Correct attachment size

I am trying using Really Simple slideshow with Wordpress and I am having issue while trying to retrive the correct image size for the slideshow. I am able to retrieve the first image without problem ...
0
votes
1answer
519 views

Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?

Im looking for a way to add an alternating even/odd class directly to each image attachment when its outputted via my function below: <?php function nongallery_img_slide( $post_id = null ) { ...
0
votes
1answer
2k views

How to get source of custom meta image?

I'm working on a CPT (custom post type) page template and would like to get the source of custom meta image. For post_thumbnail's this is rather easy using wp_get_attachment_image_src(), but if I ...
2
votes
1answer
273 views

query attachments of parent page if attachments of current page are smaller than …

I'm using WPQuery and get_children($query_images_args) to query attachments from the current page. If the current page has no attachments assigned I'm querying the images of the parent page. This ...
0
votes
1answer
262 views

Attachment Image using wrong src?

I've had some issues recently with this code below to display the featured image of a page: add_theme_support( 'post-thumbnails' ); add_image_size("homepageFeatured", 250, 250, false); ...
0
votes
1answer
322 views

foreach repeat html structure after every nth for attachment [closed]

I am trying to achieve result with below structure in foreach loop where after every two images it will repeat entire structure. I have some basic knowledge for something I can use eg. counter++; and ...
2
votes
1answer
720 views

query attachment images … if no attachments -> get attachments of parent page?

I use this to query all attachments of the current page or post I'm on … $query_images_args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => ...
0
votes
1answer
856 views

WP_Query: attachment image in “full” size?

I'm using the following script for my current project. $query_images_args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', ...
0
votes
1answer
618 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
vote
2answers
160 views

Exclude images uploaded via meta boxes from Wordpress gallery

I am using the following simple get attachment code to display all images attached to a certain post but I want to be able to exclude the images uploaded via a couple of custom meta boxes that are ...
0
votes
1answer
421 views

Using add_image_size in functions.php to get original uploaded file

It is possible to use add_image_size in functions.php to get the original uploaded file size. Because when I uploaded the images to my posts I cropped them in order to have 1x1 ratio for all my image ...
0
votes
1answer
1k views

How to get both image attachment ID and url

I am using advanced custom fields repeater-field to get the image url like this: <?php the_sub_field('billede'); ?> But I also want to get the attachment ID for the image, to be used for ...
0
votes
1answer
323 views

Returning an image url from its attachment ID using a custom post type plugin

I'm using a custom post type plugin that returns an uploaded file's attachment ID instead of its url. I've been able to get the image to display using wp_get_attachment_image_src as outlined in the ...
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?
2
votes
1answer
386 views

Prevent Width and Height Attributes in Image Tag Output

I'm trying to control the output of the random image within this bit of code. The end goal is to NOT output the width and height attributes for the image. I want this: <img src="URL HERE" ...
1
vote
1answer
3k views

get the attachement url for the medium sized image

Hi I'm using some code to create a slideshow with lytebox functionality - the following code is used in the loop to pull each image attached to a post in sequence. It seems to be only pulling the ...
1
vote
3answers
3k views

use wp_get_attachment_image() to show attachments

I really hope this is a facepalm moment, b/c i'm getting frustrated with this. Making a quick loop to show certain attachment images. lifted it almost straight from the codex but ...