@弗兰普。是正确的,但如果您想使用代码路线,下面是如何获得网站的RSS提要。您可以根据需要进行复制,或者将多个元素组合成一个数组等。
Let\'s get our RSS Feed from ABC.com
$rss = fetch_feed(\'http://abc.com/feed\'); // Or where ever that websites feeds are located. You can add query variables to narrow down categories too.
if ( ! is_wp_error( $rss ) ){ // If the feed exists we can do some stuff like limit how many we need.
$maxitems = $rss->get_item_quantity( 10 ); // return 10 or if there is not 10 posts, return the max posts found.
$rss_items = $rss->get_items( 0, $maxitems ); // Get posts sub 0 through posts sub $maxitems
}
Now let\'s list our RSS Feed, if there is one
<ul id="delicious_feed">
<?php if ( $maxitems == 0 ) : ?>
<li>No Items Found.</li>
<?php else : ?>
<?php // Loop through each feed item and display each item as a hyperlink. ?>
<?php foreach ( $rss_items as $item ) : $i++; ?>
<li>
<a href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank"
title="<?php printf( __( \'Posted %s\', \'my-text-domain\' ), $item->get_date(\'j F Y | g:i a\') ); ?>">
<?php echo esc_html( $item->get_title() ); ?>
</a>
<?php $item->get_description(); ?>...
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>