This is a simple WordPress plugin that is largely based off of Automattic's Syndication plugin. Easily setup feeds to be syndicated into WordPress. You can map feed attributes to post fields or post meta. Syndicated content can be mapped to any post type you want. The plugin comes with a convenient settings page so you can configure things like when feeds are syndicated.
Feed Pull takes a lot of concepts from Syndication. Syndication is a more advanced plugin that offers more than just feed pulling. Here are some differences between the two plugins
Sometimes feeds make use of prefixes on certain elements. This happens for a variety of reasons; one is to avoid conflicts. Prefixes should have a namespace defined somewhere using an "xmlns" attribute. Feed Pull lets you define custom namespaces. This feature is advanced and not needed in most cases.
However, certain feeds, like the Atom feeds outputted by WordPress define a document level namespace without a prefix. This is totally fine except it makes XPath queries difficult. Feed Pull should automatically detect if this situation is happening and create a namespace with the prefix "default" and the url "http://www.w3.org/2005/Atom". You should use the prefix in your XPath queries. For example, instead of "//feed/entry", your query should be "//default:feed/default:entry". Instead of "title" in your field map, your query should probably be "default:title".
You can learn more about namespaces here: http://www.w3schools.com/xml/xml_namespaces.asp
When configuring a source feed, you need to tell Feed Pull which XML nodes map to where within WordPress. Here are the current mapping types supported by the plugin:
Let's see these mapping types in action. Here is a super simple feed structure:
<channel>
<item>
<title>Post Title!</title>
<guid>http://yoursite.com/post-title</guid>
<copyright>CNN.com</copyright>
<tag>United States</tag>
<tag>Politics</tag>
</item>
<item>
<title>Another Post!</title>
<guid>http://yoursite.com/another-post</guid>
<copyright>CNN.com</copyright>
<tag>Celebrities</tag>
</item>
</channel>
As you can see our simple XML document contains two "items". We installed Feed Pull because we want to create posts within WordPress for each of those items. Now we need to map XML nodes to places within each new post being created. Within the Field Mapping meta box there are two required mappings: Title and GUID. Therefore we MUST pick XML nodes in our feed to map to these things. For post_title, our "Source Field" will be "title". For guid, our "Source Field" will be guid. Simple right?
Now we can map whatever nodes we want to post meta in our feed. For educationally purposes, let's say we want to map "copyright" to post meta for each new post being created. To do this our "Source Field" would be "copyright". Our new post location can be named whatever we want; let's say "post_copyright". For "Mapping Type", we choose "Post Meta".
Like post meta there are no required taxonomy mappings. Let's create one anyway! We want the "tag" nodes in our feed to map to the "post_tag" taxonomy in WordPress. Therefore we create a new field mapping row with "tag" as "Source Field", "post_tag" as "New Post Location", and "Taxonomy" as "Mapping Type".
Follow the configuration instructions above to setup the plugin.
Within the terminal change directories to the plugin folder. Initialize your testing environment by running the following command:
For VVV users:
bash bin/install-wp-tests.sh wordpress_test root root localhost latest
For VIP Quickstart users:
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
where:
wordpress_test
is the name of the test database (all data will be deleted!)root
is the MySQL user nameroot
is the MySQL user password (if you're running VVV). Blank if you're running VIP Quickstart.localhost
is the MySQL server hostlatest
is the WordPress version; could also be 3.7, 3.6.2 etc.Run the plugin test suite:
phpunit
This plugin contains a valid Dockunit file for running unit tests across a variety of environments locally (PHP 5.2 and 5.5). You can use Dockunit (after installing it via npm) by running:
dockunit
If you identify any errors or have an idea for improving the plugin, please open an issue.
Feed Pull is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.