• Problem: I needed to syndicate my one blog’s (site 1)categories as two separate feeds. I needed to include images in the feeds as well. These feeds needed to be “imported” into my other blog’s (site 2) sidebar.

    Solution: in site 1’s function.php file I added the following code found on this website: https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/ :

    function wpbeginner_postrss($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $coolcustom = get_post_meta($postid, ‘coolcustom’, true);
    if(is_feed()) {
    if($coolcustom !== ”) {
    $content = $content.”

    <div>”.$coolcustom.”</div>\n”;
    }
    else {
    $content = $content;
    }
    }
    return $content;
    }
    add_filter(‘the_excerpt_rss’, ‘wpbeginner_postrss’);
    add_filter(‘the_content’, ‘wpbeginner_postrss’);

    I modified for my own custom field.

    On site 2 I used the image feed widget to import the two feeds. But I had to be sure to use the following feed url(s): https://www.example.com/category/categoryname/feed/rss

    i initially didn’t use the …/feed/rss and the feed wouldn’t import the custom field image I had set up. by including the trailing …/rss at the end of the feed url it worked perfectly.

    https://www.ads-software.com/extend/plugins/image-feed-widget/

  • The topic ‘Image Feed Widget works well with extra function.php code’ is closed to new replies.