Kategoriebild Programieren

TNG-RSS plugin creates WordPress articles from the TNG feed

Recently, I had another idea how the integration of WordPress and The Next Generation of Genealogy Sitebuilding (or short „TNG“) can be improved. TNG delivers a RSS feed through its tngrss.php file. This feed keeps track of all database changes, which are applied to individuals, families or media. Consequently, the idea was born to have a plugin, that summarizes these changes in WordPress articles.

In absence of time and programming skills, I ordered this plugin at Andreas Krischer. The plugin has been kept simple; there is only one button in the WordPress backend to read the feed. With each run, the plugin saves a time-stamp in the database. Thus, it recognizes new feed items since the previous execution. All changes of one days are merged into an single article. As of today, there are no settings in the backend; feed URL as well as author, category and tags will be defined in the PHP file.
The decision towards the manual execution has been made, since the changes in TNG are rather sporadic. Continuously polling the feed would have been an unnecessary waste of resources.

The plugin is not entirely complete. But, it serves its purpose and works flawlessly. Thus, I am publishing it here for other hobby genealogists, who are working on the integration of TNG and WordPress. For the future, it would be nice to have internationalization. In case someone improves the plugin, I would appreciate when you leave a comment.


Plugin Name: TNG-RSS
Description: Loads a RSS Feed from TheNextGeneration (genealogy software) and creates WP articles from the feed
Version: 1.1
Author: Andreas Krischer, Marcus Zurhorst
Author URI: http://akbyte.com/
License: GPL3
define('TNG_RSS_CATEGORY','31');         //IDs comma separated
define('TNG_RSS_TAGS','tng-updates');    //Tag names comma separated
define('TNG_RSS_AUTHOR','2');            //ID
add_action( 'wp_dashboard_setup', 'tng_rss_dashboard_widget' );
function tng_rss_dashboard_widget() {
function tng_rss_dashboard_widget_content() {
<form method="post" action="index.php"> 
<input type="hidden" name="tng_rss" value="true">
<?php submit_button('Create new TNG Post'); ?>
if($_POST['tng_rss'] == 'true') {
if( !$xml = simplexml_load_file(TNG_RSS_FEED_URL) ) {
echo 'Could not read RSS file!';
$last_update = intval(get_option('tng_rss_last_update','0'));
$items = array();
foreach($xml->channel[0]->item as $item) {
$pubDate = strtotime(date('d.m.Y',strtotime($item->pubDate)));
if($pubDate <= $last_update)
$items[strtotime(date('d.m.Y',$pubDate))][] = $item;
$postcount = 0;
foreach($items as $date => $date_items) {
if($date > $last_update) {
$last_update = $date;
$content = '<ul>';
$strdate = date('l, d. F Y', $date);
foreach($date_items as $item) {
$title = preg_replace("#\([^\)]*\)#", "", $item->title);
$content .= '<li>';
$content .= '<a href="'.$item->link.'" target="_blank">'.$title.'</a> - '.$item->description;
$content .= '</li>';
$content .= '</ul>';
$content .= '<br><small>'.$strdate.'</small>';
$title = 'TNG Updates vom '.date('d.m.Y',$date);
$post = wp_insert_post(array(
'post_content' => $content,
'post_title' => $title,
'post_status' => 'publish',
'post_category' => explode(',',TNG_RSS_CATEGORY),
'tags_input' => explode(',',TNG_RSS_TAGS),
'post_author' => TNG_RSS_AUTHOR,
'post_date' => date('Y-m-d H:i:s',$date)
if($post > 0) {
else {
echo 'Article '.$title.' could not be created.';
echo $postcount.' article(s) added.';



Ein Gedanke zu „TNG-RSS plugin creates WordPress articles from the TNG feed“

Schreibe einen Kommentar