NOTE: for people who want to use an RSS reader, here is the rss.xml
channel->item); // Sort the items by pubDate usort($items, function($a, $b) { $a_time = strtotime($a->pubDate); $b_time = strtotime($b->pubDate); return $a_time - $b_time; }); // Debugging foreach ($items as $item) { // Debugging echo $item->pubDate . ' => ' . strtotime($item->pubDate) . '' . date('F j, Y', strtotime($item->pubDate)) . '
'; // Split the content into sentences $sentences = preg_split('/(?<=[.?!])\s+(?=[a-z])/i', $item->description); // Extract the first 5 sentences of the content $preview = implode(' ', array_slice($sentences, 0, 5)); // Add three dots at the end of the preview, if necessary if (count($sentences) > 5) { $last_char = substr($preview, -1); if ($last_char != '.') { $preview .= '...'; } else { $preview .= '..'; } } echo $preview; // If there are more than 5 sentences, add a "Read More" link if (count($sentences) > 5) { echo '