mbr_related_posts
Usage
This shortcode retrieves and displays an HTML link list of related posts.
Parameters
Parameters | Description |
---|---|
cat | The category IDs used for the selection of the related posts specified in a comma separated string. Default: none. Required: yes. |
limit | The number of related posts to retrieve and display. Default: 5 Required: no. |
display | What to display in the list. Permitted Values: title, which displays only the titles of the related posts and title_excerpt, which displays both the title and an excerpt of the related posts. Default: title Required: no. |
excerpt_len | The length of the post excerpts. Default: As set in ActiveMember360, Settings, Excerpts, Max. length for WP-generated excerpts. Required: no. |
Validity
This shortcode is evaluated for any type of visitor.
Conditional Branching
This shortcode does NOT support conditional branching with [ELSE_related_posts].
Nesting
Shortcode nesting is NOT supported.
Examples
- Example 1
- Example 2
Displays a HTML link list of 10 related posts from category ID 72 showing the page title as the link:
[mbr_related_posts cat='72' limit='10']
Displays a HTML link list of 4 related posts from category ID 72 showing the page title as the link then followed by the excerpt limited to 30 words:
[mbr_related_posts cat='72' limit='4' display='title_excerpt' excerpt_len='30']
API
For direct use in PHP code use the function mbr_related_posts()
in a structure as illustrated here:
$related_post = mbr_related_posts( array( 'cat' => '123,234', 'limit'=>5, 'display'=>'title', 'excerpt_len'=>0 ) );