Image not displaying through custom field in wordpress
# October 10, 2012 at 4:15 am
I was trying to customize my theme and got the following problem..
The image was not displaying on the homepage in img tag even after getting the correct and full path of the image. But then I tried using bloginfo(‘template_directory’) then my image was displayed. The code I used was < ?php bloginfo('template_directory');?>/product-images/prod-sprunkler.png” /> where product-images is the folder which contain the image named prod-sprunkler.png.
Now I was trying to get the image through custom field that is I have stored “/product-images/prod-sprunkler.png” in the custom field known as product_image.
So when I am concatenating these two functions to get the full path I am not getting the desired output and the image is also not displayed.
Is this concatenation problem or what? And is there any other solution to display images rather then bloginfo()??
The output is I am not getting any image even after trying all possible combinations…
I want to retrieve the field like I have done for price, dimensions and product-code..(all 3 are custom fields).
I have used get_post_meta() for retreiveing the fields..
please help..# October 10, 2012 at 11:58 am
In the course, I put the images at the ROOT of the websites in /product-images/. That is because on a site like this, the images are part of the content of the site, not the theme. If you’re linking to them with bloginfo(‘template_directory’) that means your linking to them from within the theme folder, which is incorrect. Move the /product-images/ out to the root of the website (e.g. the same level you’ll find your wp-config.php file)# October 11, 2012 at 4:38 am
Sir, I tried as what you said earlier and now as well.. But still not able to get the images in place. Please have a look at the site url
http://acheiver.netne.net/here/ . Now I have removed that bloginfo(‘template_directory’) and have used get_post_meta() method to get the required custom field. If you have time I can give you my ftp and wp-admin account so that you can check this matter better.
You must be logged in to reply to this topic.