Title: problem with : echo
Last modified: August 19, 2016

---

# problem with : echo

 *  Resolved [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/)
 * hi
    i have always problems with “echo”, this time i add the tag: **<?php bloginfo(‘
   stylesheet_directory’); ?>/cat-banner/** and the script dont work, error message:
   Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’
 *     ```
       <?php
       foreach((get_the_category()) as $category) {
       echo '<?php bloginfo('stylesheet_directory'); ?>/cat-banner/' . $category->cat_name . '.jpg" alt="' . $category->cat_name . '" />';
       }
       ?>
       ```
   
 * Thanks for help.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888386)
 * You have incorrectly nested php tags. De-nest bloginfo. Oh, and don’t echo bloginfo.
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888533)
 * sorry, but i don’t understand you, can you pls provide an example.
    thanks
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888534)
 * Nesting is one tag inside another: `<?php <?php ?> ?>`
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888539)
 * 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.
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888603)
 * i need some help please.
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888606)
 * Don’t echo bloginfo:
 * [http://codex.wordpress.org/Template_Tags/bloginfo](http://codex.wordpress.org/Template_Tags/bloginfo)
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888633)
 * can you please to correct for me the PHP syntax, i’will be so happy if you do.
 *  [KS](https://wordpress.org/support/users/karl19/)
 * (@karl19)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888704)
 * 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](http://codex.wordpress.org/Template_Tags/get_bloginfo)
 *  Thread Starter [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * (@taghaboy)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888708)
 * Hi **karl19**,
    Thanks a lot for your help, the code work perfectly. **thanks
   again**

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘problem with : echo’ is closed to new replies.

## Tags

 * [T_STRING](https://wordpress.org/support/topic-tag/t_string/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [taghaboy](https://wordpress.org/support/users/taghaboy/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/problem-with-echo/#post-888708)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
