last day (14 days later) » 

3:33 PM
0
A: Wordpress Custom Post type - Images

yiviChange this: <div data-thumb="<?php if ( has_post_thumbnail() ) { the_post_thumbnail('full'); } ?>" for this: <div data-thumb="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID )); } ?>" Same thing in your second "if". it's not the prettiest c...

 
thank you for your answer. I have done this.. But not working.. check <div data-thumb="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); } ?>" data-src ="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); } ?>">
the code has generated this <div data-thumb="" data-src ="">
 
Sorry, I had mistyped something. Check with my amended answer please.
 
It doesn't work either. same outPut.
 
Try replacing $post-ID for $my_query->post->ID
Or if not, "the_ID()"
 
<div data-thumb="4" data-src="4"> thats what printed out
nothing is working for me ...
should I show you the printed query result
may be it helps you
 
3:35 PM
ok, so write <div data-thumb="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( the_ID() )); } ?> and get that?
or were you just putting in the_ID() on its own?
are you around?
 
I have replaced the post->id to this one the_ID
then I got that result
 
so you have this:
<div data-thumb="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( the_ID() )); } ?>
?
 
Yes.. Let me try this one again
<div data-thumb="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( the_ID() )); } ?>"
data-src="<?php if ( has_post_thumbnail() ) { wp_get_attachment_image_src( get_post_thumbnail_id( the_ID() )); } ?>">
this is what I have done
 
this is what printing out
<div data-thumb="4"
data-src="4">
 
weird. You are getting the id but not the attachment src. let me think it over for a second.
 
3:40 PM
ook
 
ok, sorry. forgot that wp_get_attachment_src returns an array, not the src by itself
let me rewrite the answer, ok? I'll just edit it there.
easier that way
 
okk
thanks
 
it's there now.
it should work
 
ok let me check
 
got it?
 
3:51 PM
yes it is printing the image.. But It is cutting the image
I want the original size
 
that's a different thing altogether. It's printing the image you are asking about...
can't help you with that, but at least you solved this problem. :)
 
okk No Problem
Thanks
 
no prob. accept the answer please?
 

last day (14 days later) »