Reference library

Article number: 303167
Last updated: 24 June 2014

Using posts for news

In this page we indicate how posts can be used to create news pages with search engine friendly naming, category filtering and RSS feeds. Using posts for news has the following advantages:

  • supports cross referencing of news stories to other stories
  • allows the creation of a single news post type then the application of different filer types to display subsets on differnet pages. Context sensitive news via category filtering 
  • supports more structured news with configurable fields to relate news posts to product lines, countries or particular locations etc
  • alternate output options are available such as calendars and diary views.
  • easier aggregation of news articles via the use of searchposts 'posttypeid_csv' argument which accepts a comma separated list 

The steps are as follows

  1. Create a post type that will collect all the information you want to store for each news story
  2. Create a page that displays the above post, the examples below show a standard list page however there are ample oppourtunities for customisation. 

Posts as news won't auto archive.

In more detail:

Create a post type ‘site wide news’, it would be a good idea to give it a name other than plain 'news' so as not to confuse the post based system with the existing traditional news module.

You can add whatever custom fields you want. A common one to add is a circular reference to the 'site wide news' as a multiselect. This then gives the potential of creating links to related news articles from within other articles.

Another common custom news field is 'category'. You can either create this as a text field or reference another new posttype with a fixed list of categories. You can then filter on these.

In extranetsand intranets a usergroup option is also handy as it give the option to fileter news articles based on the logged in user user group. An example of the news post type set up is shown below.

news6

After creation of the post type the 'site wide news' can be populated from the 'edit' tab as shown below.

news4

A new page is then created with the content type set as 'posts:site wide news'. The resulting default page is shown below.

news3

The above page could be completely customised as with all the post pages by altering the relevant XSLs in the page content section. Similarly the news could be filtered by adding arguments into the 'XML parameters' field. For example the addition of '&custom_category=sales' would then filter the news to only those tagged with a 'sales' category.

Similarly if a news summary listing was required for the sites' front page this could be obtained as a data island using the following as the XML source:

http://<domain>/RSS-Posts.aspx?id=46&maxage=100&striphtml=1&custom_category=sales

Will provide an RSS formatted feed from posttype 46 for the last 100 days, taggfed with category 'sales' and strip any markup from the body block. This latter argument is handy in case a truncated version of the summary is wanted in the listing.

Related questions


This article was last updated on 24 June 2014. Did you find it helpful?