0

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 */
2

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');
  • Brilliant.. need to pay more attention to php scripts. Thanks a ton – Sledge81 Jul 25 '11 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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