Latest News plugin

This simple WordPress plugin provides facilities to write news items and to output them on your WordPress website.

The news stories are authored using the standard WordPress facilities as provided for writing posts.

This plugin will add a new Latest News menu item to the Admin menu. This allows new news items to be created and existing news items to be edited.

This plugin also provides a template tag to list of latest news items. This template tag can be customised to:

  • List the titles of the news items that link to the relevant posts. This is suitable for placing in the sidebar
  • List the news items as posts. This would typically be placed on the home page of your blog or on a custom news page


jep_latest_news_loop( $args );


'news_items' => 5, 
'title' => TRUE,
'content' => TRUE, 
'before_title' => '<h3>',
'after_title' => '<h3>', 
'before_entry' => '<div class="entry-content">',
'after_entry' => '</div>'


The number of news items that will be output, the default is 5


Whether the title of the news item will be shown, defaults to TRUE


Whether the content of the news item will be shown, defaults to TRUE


The HTML markup that should appear before the title, defaults to <h3>


The HTML markup that should appear after the title, defaults to </h3>


The HTML markup that should appear before the content,
defaults to <div class=”entry-content”>


The HTML markup that should appear after the content, defaults to </div>


To produce a list of the most recent 10 news stories suitable for inclusion in the sidebar the following parameter settings can be used.

<li class="widget-container">
<h3>Latest News</h3>
   <?php $args= array(
        'news_items' => 3, 
        'content' => FALSE, 
        'before_title' => '<li>',
        'after_title' => '</li>'

To output the three latest news items as a list of posts the following code can be added to a page:

<h2>Latest News</h2>
<?php $args=array(
        'news_items' => 3

Creating a Latest News page

The first step is to create a new template file, first find the path for your theme, for the default theme the path is:


Navigate to that folder and create a new PHP file called ‘news.php‘. Then add the following code to the new file and save it.


 * The template for displaying latest news items.
 * @package WordPress
 * @subpackage Choros1
 * @since Choros1 1.0
 * Template Name: news
get_header(); ?>
<div id="content">
	<h2>Latest News</h2>
	<?php $args=array(
	   'news_items' => 3
<?php get_sidebar(); ?>
<?php get_footer(); ?>

The next step is to create a new page in your WordPress blog called ‘latest news‘ and then set the Template drop-down to News.

Displaying the Latest News page will then list the latest three new items that have been entered together with the text of the post.