Im Zuge meiner Neustrukturierung in Sachen Design bin ich die Feed-Dateien ebenso angegangen und habe den Atom-Feed von WordPress valide, nach Version 1.0, gemacht.
Dazu ist ein wenig Arbeit notwendig. Den nötigen Code stelle ich im folgenden bereit, bearbeiten muss man die wp-atom.php
in Root-Verzeichnis von WordPress.
Aufpassen, bei einem Update von WP könnte es sein, dass die Datei überschrieben wird, je nach dem ob die Datei beim Update betroffen ist oder ob du das komplette Package einspielst.
die wp-atom.php mit Feed-Validität nach Atom 1.0:
<?php
if ( empty($wp) ) {
require_once('wp-config.php');
wp('feed=atom');
}
header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true);
$more = 1;
?>
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_option('rss_language'); ?>"
<?php do_action('atom_ns'); ?>
>
<id><?php bloginfo_rss('url') ?>/</id>
<link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
</link><link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
<title type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><?php bloginfo_rss("description") ?></div></title>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
<rights>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></rights>
<?php do_action('atom_head'); ?>
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<entry>
<author>
<name><?php the_author() ?></name>
</author>
<title type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">< ![CDATA[<?php the_title_rss() ?>]]></div></title>
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
<id><?php the_guid(); ?></id>
<updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
<?php the_category_rss('rdf') ?>
<summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">< ![CDATA[<?php the_excerpt_rss(); ?>]]></div></summary>
<?php if ( !get_settings('rss_use_excerpt') ) : ?>
<content type="<?php bloginfo('html_type'); ?>" xml:base="<?php permalink_single_rss() ?>">< ![CDATA[<?php the_content('', 0, '') ?>]]></content>
<?php endif; ?>
<?php rss_enclosure(); ?>
<?php do_action('atom_entry'); ?>
</link></entry>
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
</link></feed>
2 Kommentare
Kommentare sind geschlossen.