Simple:Press Documentation

Template Tag: Author Posts

The Template Tag Author Posts displays all the posts for the specified author id – forum visability rules apply

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_AuthorPostsTag(() and the file that makes the magic happen is sp-AuthorPosts-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 but the author ID number is required.

Options

  • tagId – unique id to use for div or list. The format is text and the default is spAdminModeratorOnlineTag
  • tagClass – class to be applied for styling. The format is text and the default is spListTag
  • authorId – The author to show the posts for. This is the user’s ID number which can be found in the forum admin section – Users – Member Information and is required
  • showForum – Show the forum name. This is 1 or 0. The default is 1
  • showDate – Show the date of the latest post.  This is 1 or 0. The default is 1
  • limit –  The number of posts to return 0 = all The default is 5
  • listTags – Wrap in <ul> and <li> tags. 1/0 and the default is 0. If 0 a div will be used.
  • echo – echo content or return content. 0/1 and the default is 1.

Usage

An example of using this tag with the default settings for user number 2.

<?php sp_AuthorPostsTag('authorId=2');?>

An example of using this tag with the default settings for user number 2 and show last 2 posts.

<?php sp_AuthorPostsTag('authorId=2&limit=2');?>

You can also call this function by using a shortcode on pages, posts or widgets.

[sp_author_posts authorid='2']

Note: Forum visability rules apply. If posts by shown author are in forums that the online user does not have access to, then the post will not be shown.

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”

More Topics In SimplePress: Plugins


Copyright © 2006-2019 Simple:Press. All Rights Reserved.