I have defined two variables as follows:
$pic = get_tax_meta($books->term_id,'books_field_id', true);
$imageurl = wp_get_attachment_image_src( $pic[id], 'list-thumb' );
print_r($pic)
results in the following:
Array ( [id] => 302 [src] => http://localhost/mysite/wp-content/uploads/2013/10/apic.jpg )
However, I get the following warning from $pic[id]:
Warning: Illegal string offset 'id'
Any idea what I'm doing wrong?
This seems to have fixed the problem:
$pic = get_tax_meta($books->term_id,'books_field_id', true);
if (isset($pic['id'])) {
$picid = $pic['id'];
};
$imageurl = wp_get_attachment_image_src( $picid, 'list-thumb' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With