Update to the above function (which should work also) - replace the entire function (lines 151-187) with this:
// Testing to see if the PHP version is up to date. If it is, add a WPFolio RSS feed widget, and if it's not, add a widget prompting an upgrade.
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
// Add WPFolio Wiki site as a Dashboard Feed
// Thanks to bavotasan.com: http://bavotasan.com/tutorials/display-rss-feed-with-php/
function custom_dashboard_widget() {
$rss = new DOMDocument();
$rss->load('http://wpfolio.visitsteve.com/wiki/feed');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
// 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5; // change how many posts to display here
echo '<ul>'; // wrap in a ul
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
// $description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<li><p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong>';
echo ' - '.$date.'</p></li>';
// echo '<p>'.$description.'</p>';
}
echo '</ul>';
echo '<p class="textright"><a href="http://wpfolio.visitsteve.com/wiki/category/news" class="button">View all</a></p>'; // link to site
}
function add_custom_dashboard_widget() {
wp_add_dashboard_widget('custom_dashboard_widget', 'WPFolio News', 'custom_dashboard_widget');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');
} else {
function print_php_error() {
$error = "<p style='color:red; font-size: 1.5em;'>You are using an outdated version of PHP. WordPress doesn't support it and neither does WPFolio! Upgrade to the latest version of PHP.</p>";
echo $error;
}
function add_error_widget() {
wp_add_dashboard_widget('error_widget', 'IMPORTANT!', 'print_php_error');
}
add_action('wp_dashboard_setup', 'add_error_widget' );
}
This should keep your site from crashing and will instead give you a text widget in the Dashboard prompting you to update to the latest version of PHP.
I've done some testing and it works fine, but it would be very helpful for someone with the actual issue to test it out. Good karma for doing so. Thanks!