Related Entries

The Related Entries tag allow you to show a list of other entries that belong to the same category as the currently viewed entry.

{exp:weblog:related_entries limit="10" backspace="6"}

<a href="{comment_path=weblog/index}">{title}</a><br />

{/exp:weblog:related_entries}

These tags must go on a page designed to show a single entry, such as a comments page.

Parameters

category=

category="1"

The category parameter allows you to add or subtract to the related categories. This is different than how the category tag normally works for the weblog tag. If you don't specify a category the query will show all entries in the same category as the one being viewed. When you add category numbers to the category parameter they will be included or excluded.

You may specify multiple categories by using the pipe character:

category="1|4|66"

Or you can exclude categories by including the word "not" followed by a space:

category="not 1|4"

limit=

limit="12"

This parameter limits the number of entries on any given page.

orderby=

orderby="date"

The "order" parameter sets the display order of the entries. Setting options for this parameter include:

In addition you can order by a custom field. Use the "short_name" of the field:

orderby="name_of_field"

sort=

sort="asc" sort="desc"

The sort order can be ascending or descending.

status=

status="open"

The weblog status to which you would like to restrict display. You can choose multiple statuses using a pipe:

status="draft|reviewed|published"

Or exclude statuses using "not"

status="not submitted|processing|closed"

username=

username="petunia"

This parameter limits the query by username. You can use the pipe character to query by multiple usernames:

username="tom|dick|harry"

Or you can add "not" to exclude usernames:

username="not tom|dick|harry|fred" You can also use the constant "CURRENT_USER" to show entries from only the currently logged in user.

username="CURRENT_USER"

This allow each logged-in user to get only their entries. Users who are not logged in won't see anything. Alternatively, you can use the constant "NOT_CURRENT_USER" to show entries except from the currently logged in user.

username="NOT_CURRENT_USER"

weblog=

weblog="which"

From which weblog to show the entries. Additionally, you can use the pipe character to separate multiple weblogs:

weblog="weblog1|weblog2|weblog3"

Or you can add the word "not" (with a space after it) to exclude weblogs:

weblog="not weblog1|weblog2|weblog3"

Variables

author

{author}

The author's screen name, if it exists; otherwise, this variable will display the username.

comment_path

{comment_path=weblog/comments}

The URL to the specified template. The ID number of the entry will be automatically added. For example, this:

<a href="{comment_path=weblog/comments}">comments</a>

Would be rendered like this:

<a href="http://www.yoursite.com/index.php/weblog/comments/234/">comments</a>

comment_total

{comment_total}

The total number of comments for a particular entry

dates

Several date variables are available for use. As with other date variables, these require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.

entry_date

{entry_date format="%Y %m %d"}

The date the entry was submitted

recent_comment_date

{recent_comment_date format="%Y %m %d"}

The date of the most recent comment associated with the entry

permalink

{permalink}

This variable defaults to site index with entry ID number:

http://www.yoursite.com/235/

In addition, you can specify a template group/template and the entry ID will automatically be added:

{permalink="weblog/archive"}

Will render as:

http://www.yoursite.com/weblog/archive/235/

title

{title}

The title of the entry

title_permalink

{title_permalink}

This variable uses the "url title" as the link. It defaults to the site index with the "url title":

http://www.yoursite.com/my_ugly_boyfriend/

In addition, you can specify a specific template group/template and the "url title" will automatically be added:

{title_permalink="weblog/archive"}

Will render as:

http://www.yoursite.com/weblog/archive/my_ugly_boyfriend/

Note: When creating a new entry, if you don't supply the "url title" then it will be automatically created from the actual entry title. Spaces are turned into underscores and quotes are removed. For example, "Joe's night out" becomes "joes_night_out".

trackback_path

{trackback_path=weblog/comments}

The URL to the specified template. The ID number of the entry will be automatically added. Use in a link:

<a href="{trackback_path=weblog/comments}">trackback</a>