comments.php: How to display an image through RELATIVE path?
-
I make my themes with ThemeFrame (a tool close to Artisteer). I’m good at html and css but zero in php language. So I’d appreciate a little help here.
Here’s an example of a post of my site, containing a comment form:
https://www.ajwan.net/wordpress/galerie-demo/10-style-diaporama/09-fleurs/fleurs-d-europe/
My question concerns the line below the text input field, starting with an imgae: a yellow Attention sign.That line is displayed as expected because the image is fetched through its ABSOLUTE path.
Here is the line of code in comments.php'comment_notes_after' => '<img style="width: 26px; height: 23px;" alt="" src="https://www.ajwan.net/wordpress/wp-content/uploads/2012/01/attention_w26.png">?Pour voir votre commentaire publié, rafraichissez la page.',
Now, for various reasons, I need taht the image is fetched through its RELATIVE path. So I tried this like I would in CSS for a background image for instance:
'comment_notes_after' => '<img style="width: 26px; height: 23px;" alt="" src="images/imagename.png">?Pour voir votre commentaire publié, rafraichissez la page.',
That didn’t work. The line was displayed without the image.
N.B. the image definitely exists in the “images” folder of my theme. It’s not like I forgot to put it there.Then someone advised me to try the WP function ‘bloginfo’ with the parameter “template_url” (which I knew nothing about)
I then tried this:'comment_notes_after' => '<img style="width: 26px; height: 23px;" alt="" src="<?php bloginfo("template_url"); ?>/images/attention_w26.png" />?Pour voir votre commentaire publié, rafraichissez la page.',
It didn’t work either. This is what was displayed on the site:
/images/attention_w26.png” /> Pour voir votre commentaire publié, rafraichissez la page.If someone could tell me what is wrong in the last code or tell me what else I should do to get the image’s relative path, I’d be most grateful.
Thanks in advance,
Fran
- The topic ‘comments.php: How to display an image through RELATIVE path?’ is closed to new replies.