• bookinfo

    (@bookinfo)


    Hello,

    I think FeedWordPress is a great Plug-in, but I do have one issue. I have the plug-in set to convert the feed items to posts, but I only want to most recent item from each RSS that I input. Is it possible to have FeedWordPress only import the most recent item?

    Thanks

    https://wordpress.org/plugins/feedwordpress/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Sascha_Foerster

    (@sascha_foerster)

    That’s probably what you have been searching for.

    Thread Starter bookinfo

    (@bookinfo)

    Okay, I’ve never used GitHub before so I have no idea which part of the code I actually need. Can you clarify a little bit? Thanks so much.

    Can you try adding this to your functions.php file?

    function fwp_first_item( $data, $fwp )
    {
        static $first = true;
        if ( ! $first ) return null;
        $first = false;
        return $data;
    }
    add_filter( 'syndicated_post', 'fwp_first_item', 10, 2 );

    This won’t limit posts by date, but it may skip all feed results except the first one.

    I need to import more than the normal 10 recent posts. I want to import more like 85 posts from a feed.

    Can you help?

    Mine pulls in more than 10 at a time. Actually, I believe it pulls in everything in the feed. Look at the feed you want to use and see how many items it contains.

    I am pulling from:

    http://www.laceandlikes.com/blog/

    There are 86 posts associated with that site.

    Thoughts?

    That feed only displays 10 items at a time. I’m not sure how to get older results. It’s up to the webmaster of the site.

    hello.I would like to ask if it’s possible with a function to syndicate 1 post (most recent) from each feed at once .I have set 10 feeds and i want, when i update them (manual or with cron job) to pull 1 post for each one (1×10=10 posts).I have tested the above function and it works but it gives me as result only 1 post from all my feeds. I have tried also to use the” limit posts by date” plugin without success. I need some help for this, thanks.

    @george09, I haven’t setup a test site with the strategy you’re using. Give this a try and see if it does what you need. When I get time I’ll check back and see if we need to make any changes. Add this to your functions.php file.

    function fwp_skip_first_item_per_feed( $data, $fwp )
        {
            static $feeds = array();
    
            $id = SyndicatedLink::id();
            if ( isset( $feeds[ $id ] ) ) return null;
            $feeds[ $id ] = true;
            return $data;
        }
        add_filter( 'syndicated_post', 'fwp_skip_first_item_per_feed', 10, 2 );

    hi and thanks for the quick reply .I tried to add this code in my functions.php and it gives me a fatal error. So i would like to ask something else that maybe is a little more easy. I tried for the same purpose to use the Limit posts by date plugin. It works for limiting the posts number but there is an issue.When a feed contains more posts than the number that i have set up to pull, the plugin limits the number of the posts but not the syndicated items(?) from the rest posts (out of my target).So in this case when i use a plugin for caching locally the images (cache images) the images from the rest posts (skipped posts) are also imported on my media library. Is any filter for the syndicated items for skip them all except those ones that icluded in the posts that i pull.Thanks again.

    the last line in the code sample above doesn’t display the ending ); is it possible you missed that?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Number of Posts’ is closed to new replies.