• Hi!

    I have a client with the blog at http://artpartner.com/news/
    The images on this blog come from Custom fields.

    The question is – how can I display those images in feedburner feed?

    I tried RSS Custom Fields, RSS Manager, WP RSS Images plugins. I also tried to add the following code (found somewhere on the web) into functions file:

    // ADD CUSTOM POST TYPES TO RSS FEED //
    
    function add_cpts_to_rss_feed( $args ) {
      if ( isset( $args['feed'] ) && !isset( $args['post_type'] ) )
        $args['post_type'] = array('post', 'results');
      return $args;
    }
    
    add_filter( 'request', 'add_cpts_to_rss_feed' );
    //flush();
    
    // ADD CUSTOM FIELDS TO FEED
    function meko6_postrss($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $img = get_post_meta($postid, 'img', true);
    $img1 = get_post_meta($postid, 'img1', true);
    if(is_feed()) {
    	if($img !== '') {
    	$content = "<img src='".$img."' style='float:left;'>".$content;
    	}
    	elseif($img1 !== '') {
    	$content = "<img src='".$img1."' style='float:left;'>".$content;
    	}
    	else {
    	$content = $content;
    	}
    }
    return $content;
    }
    add_filter('the_excerpt_rss', 'meko6_postrss');
    add_filter('the_content', 'meko6_postrss');

    The code is not working as well, but I suspect the reason might be because the posts come from custom post types. Could anyone give me some tips on how could I modify the code so it would work with custom post types?

  • The topic ‘Add custom fields into Feedburner feed’ is closed to new replies.