-3
votes
0answers
20 views

How to get file name of featured image? [duplicate]

How to show file name of featured image in post on single.php? For example: Name of featured image is: "current-post-featured-image-file-name.jpg"
0
votes
2answers
38 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
81 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
79 views

Adding title and description to subpage's featured image

Hej! I have a subpage to display it's subpage featured image. I would like to add the title and description to beneath the thumbnail. Today my code look like this > In the functions.php function ...
0
votes
0answers
35 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
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
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
46 views

Create a Link to Larger Image from within list of smaller images

I have this in my functions.php: function display_images_in_list($size = thumbnail) { if($images = get_posts(array( 'post_parent' => get_the_ID(), 'post_type' => ...
0
votes
0answers
40 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
140 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. ...
-1
votes
2answers
137 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 ( ...
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 ...
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
379 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
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 ) { ...
2
votes
1answer
252 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
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); ...
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' => ...
0
votes
1answer
793 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
560 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 ...
2
votes
1answer
358 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
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 ...