WordPress.org

Ready to get started?Download WordPress

Forums

Image Feed Widget
Image Feed Widget works well with extra function.php code (1 post)

  1. ajbertra91
    Member
    Posted 2 years ago #

    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: http://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): http://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.

    http://wordpress.org/extend/plugins/image-feed-widget/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by ajbertra91
  • This topic is not a support question
  • WordPress version: 3.2.1