sp_UnansweredPostsTag() – The Template Tag Unanswered Posts tag displays the most recent topics that only have 1 post in them which would make them unanswered or have no replies.
If the value of any of this function’s arguments/parameters or the placement of this function in standard supplied Simple:Press theme pages is to be changed, it is highly recommended that a Child Theme or a Custom Theme be developed to accept the changes.
$args – List of arguments for controlling display.
‘tagId’ => ‘spUnansweredPostsTag’
‘tagClass’ => ‘spListTag’
‘listId’ => ‘spListItemTag%ID%’
‘listClass’ => ‘spListItemTag’
‘linkClass’ => ‘spLinkTag’
‘textClass’ => ‘spTextTag’
‘avatarClass’ => ‘spAvatarTag’
‘listTags’ => 1
‘forumIds’ => ”
‘limit’ => 5
‘itemOrder’ => ‘FTUD’
‘linkScope’ => ‘forum’
‘beforeForum’ => __(‘Forum: ‘, ‘sp-ttags’)
‘afterForum’ => ‘<br />’
‘beforeTopic’ => __(‘Topic: ‘, ‘sp-ttags’)
‘afterTopic’ => ‘<br />’
‘beforeUser’ => __(‘By: ‘, ‘sp-ttags’)
‘afterUser’ => ”
‘beforeDate’ => ‘& n b s p; -‘ (but no spaces between characters)
‘afterDate’ => ”
‘avatarSize’ => 25
‘niceDate’ => 1
‘postTip’ => 1
‘truncate’ => 0
‘echo’ => 1
‘tagId‘: A unique CSS id to use for div or list. This would be text.
‘tagClass‘: The CSS class to be applied for styling. This would be text.
‘listClass‘: The CSS class to be applied to list item style. This would be text.
‘linkClass‘: The CSS class to be applied to link style. This would be text.
‘textClass‘: The CSS class to be applied to text labels. This would be text.
‘avatarClass‘: The CSS class to be applied to avatar. This would be text.
‘listTags‘: Flag to indicate whether or not to wrap in <ul> and <li> tags. A one (1) is true and the tags are used. A zero (0) is false and a div will be used.
‘forumIds‘: A comma delimited list of forum id numbers. This is optional. The default is all forums.
‘limit‘: The number of topics to show in the list. This would be an integer number.
‘itemOrder‘: This parameter controls both which components are displayed and also the order in which they are displayed. This is entered as text and must be upper case (Capitals) without spaces or other characters.
‘linkScope‘: Controls what items are made into links (‘a’ tags): This is entered as text. NOTE that the Topic will ALWAYS be formed as a link. The following options are available:
‘beforeForum‘: The text to display before the forum title.
‘afterForum‘: The text to display after the forum title.
‘beforeTopic‘: The text to display before the topic title.
‘afterTopic‘: The text to display after the topic title.
‘beforeUser‘: The text to display before the user information.
‘afterUser‘: The text to display after the user information.
‘beforeDate‘: The text to display before the date.
‘afterDate‘: The text to display after the date.
‘avatarSize‘: The Pixel size of the avatar if it has been selected for display in the argument “itemOrder”. This is an integer number.
‘niceDate‘: Flag to indicate whether to display the date of the post in the “nicedate” format (‘X days/weeks/months ago’ where “X” is an integer number). Examples of the “nicedate” format are “1 week ago” and “5 days ago”. A one (1) is true and causes the post’s date to be displayed in “nicedate” format with the post. Zero (0) is false and causes the post’s date to not be displayed in the “nicedate” format with the post but as only the date. See sp_niceDate for the description of niceDate in the Codex.
‘postTip‘: Flag to indicate whether to display an excerpt of the post in a bubble when hovering the cursor over the topic title/link of a post in the list. This is similar to the results the argument ‘toolTip’ provides. A one (1) is true and an excerpt of the post is displayed when the cursor is hovered over the listed post’s title/link. A zero (0) is false and no post excerpt is shown when the cursor is hovered over the listed post’s title/link.
‘truncate‘: The number of characters at which to truncate both the forum title and topic title displayed in their respective headers. This is an integer number. A zero (0) results in no truncation.
‘echo‘: Flag to indicate whether to write out the generated html display code or just return the html display code. One (1) is true and causes the html display code to be written to the display. Zero (0) is false and causes the html display code to be returned instead of written out.
This template tag is included in the Template Tags and Widgets plugin available on the Simple:Press Our Plugin Library page.
The Using Plugins page describes how you obtain and install the Template Tags and Widgets plugin.
This is also the template tag file used by the Unanswered Topics Plugin in its ‘spUnansweredView.php’ file.
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.
This function can also be called by using a shortcode on pages, posts or widgets.
Since Simple:Press version 5.1.
Codex page sync’d to code version 6.0.1.
sp_UnansweredPostsTag() is located in …sp-resources/forum-plugins/template-tags/library/sp-UnansweredPosts-tag.php.