The Template Tag Newest Topics displays the most recent topics in the forums
This template tag is included in the Template Tags and Widgets plugin available on the Simple:Press Our Plugin Library page.
The function used is sp_NewestTopicsTag() and the file that makes the magic happen is sp-NewestTopics-tag.php which is located in the plugin’s template-tags/library folder.
You can pass optional arguments to the function for formatting and display of special text or to show/not show specific items.
tagId – A unique id to use for div or list. This would be text. The default is spNewestTopicsTag.
tagClass – The class to be applied for styling. This would be text. The default is spListTag.
listId – The ID to be applied for styling. This would be text. The default is spListItemTag%ID% where %ID% is the topic number.
listClass – The class to be applied to list item style. This would be text. The default is spListItemTag.
linkClass – The class to be applied to link style. This would be text. The default is spLinkTag
textClass – class to be applied to text labels. This would be text. The default is spTextTag.
listTags – Wrap in <ul> and <li> tags. This would be true or false. The default is true. If false a div will be used.
forumIds – A comma delimited list of forum id numbers. This is optional. The default is all forums.
limit – How many topics to show in the list. This would be a number. The default is 5.
avatarClass – The class to be applied to avatar. This would be text. The default is spAvatarTag
itemOrder – This is entered as text. The Default is FTUD.
This parameter controls both which components are displayed and also the order in which they
are displayed. Use the following codes to construct this parameter. No spaces or other
characters can be used. Must be uppercase (Capital) letters.
F – Displays the forum name
T – Displays the Topic name
A – Displays the users Avatar
U – Displays the Users display name
D – Displays the date of the post
If not passed the default is FTUD – which does not include the users Avatar.
linkScope – This is entered as text. The Default is ‘forum’.
This parameter controls what items are made into links (‘a’ tags): The following options
are available. NOTE that the Topic will ALWAYS be formed as a link:
forum – Display the Forum name as a link as well as the Topic
all – Make the entire entry a link to the Topi
beforeForum – The text to display before the forum title. The default is ‘Forum: ‘
afterForum – The text to display after the forum title The default is ‘<br />’
beforeTopic – The text to display before the topic title The default is ‘Topic: ‘
afterTopic – The text to display after the topic title The default is ‘<br />’
beforeUser – The text to display before user The default is ‘By: ‘
afterUser – The text to display after user The default is no text.
beforeDate – The text to display before date The default is ‘ -‘
afterDate – The text to display after date The default is no text.
avatarSize – The Pixel size of avatar if showing. This is a number. The default is 25.
niceDate – Show date as ‘nice’ date. This is a true/false. The default is true. See Codex here for description of niceDate.
truncate – truncate both forum and topic header – optional. Number of characters to truncate both the forum title and topic title down to. The default is 0 (zero) which means do not truncate.
postTip – Option to include post content extract on link to be shown on mouse over. This is a true/false. The default is true which is a 1. Using 0 (zero) would be false.
echo is a true/false expression using 1 as true and 0 as false. The default is true.
NOTE: True must be expressed as a 1 and False as a zero
An example of using this tag with only default settings.
An example of using this tag with the item order set, The limit set to 10 and the HTML <hr /> after the date.
You can also call this function by using a shortcode on pages, posts or widgets.
The Using Plugins page describes how you obtain and install the Template Tags plugin. Once installed you would activate it from the Simple:Press administration page Available “Plugins – Install Simple:Press Plugins”