The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
106 views

Register an additional image size for only some images in my media library

There is a type of post on my blog which requires one extremely large image (such that it can be zoomed). I don't want to register a new image size, because I only need a certain small subset of ...
3
votes
2answers
533 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 ...
3
votes
1answer
163 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 ...
2
votes
1answer
253 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 ...
2
votes
1answer
359 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" ...
2
votes
2answers
526 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 ...
2
votes
1answer
678 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' => ...
1
vote
1answer
557 views

How to paginate attachments in a secondary query as gallery?

I have this code that shows all images attached to my post-type. Is there a way to paginate those? I have like 25 pics and I wan't to avoid scroll as much as I can. Code: <div class="galleries ...
1
vote
2answers
903 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
2answers
166 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
vote
1answer
2k 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 ...
1
vote
1answer
2k 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( ...
1
vote
1answer
318 views

Exclude featured image from attachment loop

For my jigoshop theme I'm able to retrieve the images attached to my product post. However it pulls all images from both the featured image and my metabox images. What I'm trying to do is make it so ...
1
vote
1answer
1k 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 ...
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 ...
1
vote
2answers
156 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 ...
1
vote
0answers
25 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, ...
1
vote
1answer
263 views

Function to auto-set a featured image that is already in use

I don't even know where to start with figuring this out.... This function for functions.php grabs the first attached image in a post and sets it as the featured image. The problem is that it will not ...
1
vote
3answers
690 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
381 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 ...
1
vote
2answers
398 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
1answer
153 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
82 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
16 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
1answer
49 views

Exact image sizes

I am trying to define an image size of exactly 290 height x 180 width for all images uploaded to my WP site. I tried updating image sizes under Settings->Media->Image Sizes but these are only max ...
0
votes
2answers
75 views

Create a link to full-sized image attachment?

I'm using some transitional css to "slide" up a div (".mask") which contains a short excerpt of the post when you hover over the post thumbnail. This works very well, but I'd also like to add a text ...
0
votes
2answers
135 views

Display number of latest images from wordpress gallery in your homepage

I was trying to get a solution for something that I am trying to accomplish. I am using the wordpress native and simple gallery to show images in a page called: "gallery" so far - very simple. it ...
0
votes
1answer
365 views

Get title of post image is attached to

So I found this post: Find the post an attachment is attached to and implemented Chip's suggestion but having a weird outcome. I am trying to pull the title of the post that the specific image is ...
0
votes
1answer
262 views

Featured Image If Else Condition

I have my banner background set to the URL of the featured image. <div id='xpro_shell_text' > <?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = ...
0
votes
1answer
141 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
695 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. ...
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
2answers
34 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
1answer
102 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 ...
0
votes
1answer
204 views

wp_get_attachment_image() not working when trying to add with and height attributes

I am using wp_get_attachment_image() to try and output an img tag with width and height attributes. Here is my code: $thumb_src = wp_get_attachment_image( $id, 'thumbnail', false, array('width'=> ...
0
votes
1answer
29 views

How do I get only a certain number of images from a post (minus the featured image)?

I have the following code (see below) that lists all attached images from a post. I'm trying to alter this code to only list the first five images, and also to exclude the featured image from the ...
0
votes
1answer
422 views

Get attachment by slug

I would like to get an image by specifying a certain slug and then echoing that address in the image src code. The slug for the image would be "book-site-header" I've looked through the ...
0
votes
1answer
81 views

Get a Page's attachments in Gallery order

Having created a page and a gallery within that page, I would like to retrieve all the images in that gallery in the order they are set when the gallery is created, i.e. the order which I drag them in ...
0
votes
1answer
95 views

Get Attachment Image Class by attachment id

I want Get wordpress media library image class. I have attachment id and I tired this but won't able to get it. print_r(wp_get_attachment_image_src( $attachment_id, $size, $icon, $attr )); How can ...
0
votes
1answer
117 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
322 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 ...
0
votes
1answer
558 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
1answer
501 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 ...
0
votes
2answers
611 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 ...
0
votes
1answer
162 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
485 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 ...
0
votes
1answer
238 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
292 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 ...