get_the_ID() get get_attachment_image() fail inside function
-
My code works perfectly fine until I enclose it in a function. Variables can pass into the function just fine and when I echo them I can see they work. But none of these functions work anymore:
get_the_ID();
wp_get_attachment_image($image->ID, ‘thumbnail’);
wp_get_attachment_image_src($image->ID, array(150, 150));Am I not allowed to put the loop inside of my own function? Once I remove the function it works as before. It seems to not be able to scope the vars properly.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘get_the_ID() get get_attachment_image() fail inside function’ is closed to new replies.