get_news

Documentation/get_news

 

Description

The most appropriate use for get_news is to create an array of news posts based on the criteria provided.

 

Usage

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

 

Parameters

$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 and output the title of each article

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

     echo $post->post_title; 

endwhile;

?>

Return

Basic WordPress 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