WordPress.org

Ready to get started?Download WordPress

Forums

Best way to add <image> to my rss feed? (7 posts)

  1. dblume
    Member
    Posted 8 years ago #

    I see that in WordPress 2.0, do_action('rss2_head') has been added to the header in wp-rss2.php.

    In WordPress 1.5, I added my own <image> tag right after <language>. But maybe in 2.0, I should make use of rss2_head? What is that, and how do I do it?

    [Edit] Sorry about the title. I didn't know escaped characters wouldn't be unescaped. Whoops.

  2. Robert
    Member
    Posted 7 years ago #

    I'de like also know the answer.

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    You can add it directly to the file if you like, or you can create a separate function to add it using the rss2_head hook. The advantage of using the action hook is that your change will survive an upgrade of the wordpress software, whereas a direct change won't.

    Just add something like this to your functions.php file (in your theme):


    function add_my_rss2_image()
    {
    echo '<image>http:whatever</image>';
    }
    add_action('rss2_head','add_my_rss2_image');

  4. IsraelBarros
    Member
    Posted 7 years ago #

    What you want meen whit http:whatever ? Is the name of my website?

  5. maerk
    Member
    Posted 7 years ago #

    The URL to your image.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Yeah, it's the URL to your image. If you don't know what the <image> tag does in RSS, then you probably should not be doing this. Go learn more about RSS first.

  7. IsraelBarros
    Member
    Posted 7 years ago #

    Ok, It's not realy sommethig that I need. What I want was a way to show the images of my posts in rss feed.
    Thank you for the explanation.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags