Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I came across this function to add image to rss feed. However, I keep getting lots of syntax errors.

/* Add RSS Logo */

function addRssImage() {
  echo "<image>
    <title>My Title</title>
    <url>" . get_bloginfo('template_directory') . "/images/logo.png</url>
    <link>" . get_bloginfo('url') ."</link>
    <width>300</width>
    <height>60</height>
    <description>MyDomain.com</description>
    </image>";
add_action('rss2_head', 'addRssImage');
/* End RSS Logo */
share|improve this question
    
What are those errors? See also stackoverflow.com/questions/705224/rss-2-0-image-in-an-item –  feeela Jul 21 '11 at 10:04

1 Answer 1

up vote 2 down vote accepted

The code you posted is missing an ending }

here is a fixed and tested version of that code, so if you still get errors they are coming from another place

function addRssImage() {
  echo "<image>
    <title>My Title</title>
    <url>" . get_bloginfo('template_directory') . "/images/logo.png</url>
    <link>" . get_bloginfo('url') ."</link>
    <width>300</width>
    <height>60</height>
    <description>MyDomain.com</description>
    </image>";
}
add_action('rss2_head', 'addRssImage');
share|improve this answer
    
Brilliant.. need to pay more attention to php scripts. Thanks a ton –  Sledge81 Jul 25 '11 at 13:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.