WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field to RSS PHP (5 posts)

  1. softservenet
    Member
    Posted 7 years ago #

    I am hoping somebody can give me a little help with this one...

    I want to customize my RSS feed to include and item from a custom field that I am adding to each post.

    I see the formatting to get the item description and title, but was hoping someone could lead me to some info on using a custom field php statement to add to the current wp-rss.php (how to get custom field 1 and custom field 2, etc. if there were multiples).

    -------------------------------

    Thank you very much if you can help with this, it'll really help me.

    Tom F.

  2. Cowdisease
    Member
    Posted 7 years ago #

    I'm having a similar problem. I want to customize my WordPress RSS feed so that if the post contains a custom field, the name of the custom field and its value appears in the feed for that post.

    To give a specific example, some of my posts will have the custom field, "Rednote", and its value could either be "Date Corrected" or "Newly Added". I would like the RSS feed to display <Rednote>Newly Added</Rednote> OR <customfield>Rednote: Newly Added</customfield> for that post.

    It doesn't look like any plugin exists to do exactly that. I have PHP experience, so I'm not afraid to dive in and modify some configuration files. I just need to be pointed in the right direction in terms of files I should be looking at and strategies I should be considering.

    Thanks for your help.

  3. daelan
    Member
    Posted 6 years ago #

    I 3rd the motion.

    I also need to be able to add data from a custom field to my feed.

    Any help on this would be greatly appreciated.

  4. doug
    Member
    Posted 6 years ago #

    This plugin is exactly what you need. If you are using WordPress 2.1, though, you will need to change line 42 & 42 from

    if($post_meta_cache[$wp_query->post->ID]) {
         foreach(get_post_custom_keys() as $key) {

    to

    if ( $keys = get_post_custom_keys() ) {
         foreach($keys as $key) {

    (The $post_meta_cache array is no longer used in 2.1.)

  5. Detour
    Member
    Posted 6 years ago #

    Thank you!

    That plugin and new lines of code worked perfectly for me. I'm using the Get Custom Field Values plugin (c2c_get_custom) and was pulling my hair out trying to get my custom field into the feeds.

    You're a life saver!

Topic Closed

This topic has been closed to new replies.

About this Topic