You have incorrectly nested php tags. De-nest bloginfo. Oh, and don’t echo bloginfo.
sorry, but i don’t understand you, can you pls provide an example.
thanks
Nesting is one tag inside another: <?php <?php ?> ?>
Thanks iridiax for reply,
i try to do some change, but i’m really not a pro in php, but even if i try:
<?php
foreach((get_the_category()) as $category) {
echo 'bloginfo("stylesheet_directory");/cat-banner/' . $category->cat_name . '.jpg" alt="' . $category->cat_name . '" />';
}
?>
and steel not work, thanks for help.
can you please to correct for me the PHP syntax, i’will be so happy if you do.
KS
(@karl19)
You’ve probably figured this out by now, but since I came past this post when I was searching for the same thing, here’s what you could do.
Rather than using bloginfo, use get_bloginfo. Then you can use something like:
<?php echo 'Your Blog Tagline is: ' . get_bloginfo ( 'description' ); ?>
I guess your code would then look like this:
<?php
foreach((get_the_category()) as $category) {
echo get_bloginfo ( 'stylesheet_directory' ) . '/cat-banner/' . $category->cat_name . '.jpg" alt="' . $category->cat_name . '" />';
}
?>
Note that stylesheet_directory is deprecated, so either use stylesheet_url to get to the main style.css, or template_directory if you want to get to the theme directory.
More info under codex.wordpress.org/Template_Tags/get_bloginfo
Hi karl19,
Thanks a lot for your help, the code work perfectly.
thanks again