How to display image?
Hi, i have a field in customizer with "upload" type. I want to display the image in header, but i have an error - "Notice: Array to string conversion in D:\OSPanel\domains\ardis-creative-agency\wp-content\themes\ardis\header.php on line 82 Array". This is how i try to display it - ";". Thank you!
The image uploader outputs an array with key attachment_id and url. Perhaps you echoed it wrong. So instead of $atts['image'], it should be $atts['image']['url'].
@jonmlas Thank you!
@jonmlas I have an error when i'm trying to do like this:
$header_image = fw_get_db_customizer_option('image_header'); echo $header_image['image']['url'];
And error is:
Notice: Undefined index: image in D:\OSPanel\domains\ardis-creative-agency\wp-content\themes\ardis\header.php on line 84
Could you try to check the value of $header_image?
You can do that by using fw_print($header_image);
Let me know the value.
@jonmlas array ( [attachment_id] => '43' [url] => '//ardis-creative-agency/wp-content/uploads/2018/06/Illustration.png' )
then, you should echo $header_image['url']; not echo $header_image['image']['url'];
@jonmlas Oh, it works, finally:) Thank you so much! I almost died solving this:)