get_news_for_source

Documentation/get_news_for_source

 

Description

The most appropriate use for get_news_for_source is to create an array of news posts that belong to the source defined.

 

Usage

<?php if (function_exists('get_news_for_source')) $loop = get_news_for_source($source_id, $type, $days_ago, $posts_per_page); ?>

 

Parameters

$source_id

(integer) (optional) The ID of the source you’d like to fetch. If no ID is provide, the ID of the current page will be used.

 

$type

(string) (optional) (popular, recent) The type of search for news we’re doing. Either ‘popular’ or ‘recent’

Default: recent

 

$days_ago

(integer) (optional) The amount of days to search back through the news, if no quantity of days is provided, news can be retrieved as far back as possible.

 

$posts_per_page

(integer) (optional) The quantity of news posts to return.

Default: 20

 

Examples

Get news for the current source and output the title of each article

 

<?php
if (function_exists('get_news_for_source')) $loop = get_news_for_source($source_id, $type, $days_ago, $posts_per_page);
/* Start the Loop */ 
while ( $loop->have_posts() ) : $loop->the_post(); 

     echo $post->post_title; 

endwhile; 
?>

 

Return

Basic values: http://codex.wordpress.org/Function_Reference/get_post#Return

Additional values added by WP News Aggregator: http://wpnewsaggregator.com/documentation/#template_tags

Web Statistics