Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_rss [ WordPress Function ]

wp_rss ( $url, $num_items = -1 )
Parameters:
  • (string) $url URL of feed to display. Will not auto sense feed URL.
  • (int) $num_items Optional. Number of items to display, default is all.
Defined at:



Display all RSS items in a HTML ordered list.

Source


<?php
function wp_rss$url$num_items = -) {
    if ( 
$rss fetch_rss$url ) ) {
        echo 
'<ul>';

        if ( 
$num_items !== -) {
            
$rss->items array_slice$rss->items0$num_items );
        }

        foreach ( (array) 
$rss->items as $item ) {
            
printf(
                
'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
                
esc_url$item['link'] ),
                
esc_attrstrip_tags$item['description'] ) ),
                
esc_html$item['title'] )
            );
        }

        echo 
'</ul>';
    } else {
        
_e'An error has occurred, which probably means the feed is down. Try again later.' );
    }
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics