Skip to main content

mbr_post

Usage

This shortcode returns data from a specified page/post record in your WordPress database.

It provides a means of duplicating content on alternate pages/posts with a different set of access conditions but without the need to maintain several content sources.

Furthermore, by allowing content parts to be drawn from several different pages/posts, it extends the content management capabilities of WordPress.

This shortcode is the identical to [mbr_page] and is provided as a means of self-documenting your intentions.

Important

Please excercise care and ensure that you do not create cyclical references e.g. 'Post 1' is not pulling content from 'Post 2', which itself is pulling content from 'Post 1'.

Parameters

ParametersDescription
idThe post ID i.e. post_id for which to return the specified field data.
Default: none.
Required: yes.
fieldSpecifies the name of a WordPress post field to return. Any field used within the WordPress post or post_meta table can be specified.
Some Permitted Values: post_title, post_date, post_content, post_excerpt.
Default: post_content
Required: no.
statusSpecifies the post status required in the post_status field for the returned data to be displayed.
Default: none.
Required: no.
excert_fbSpecifies whether a fallback to the excerpt is used if the status is not met. Please note that this ONLY applies when the specified field is set to post_content.
Permitted Values: yes, y, true, t, or 1.
Default: none.
Required: no.

Validity

This shortcode is evaluated for any type of visitor.

Conditional Branching

This shortcode does NOT support conditional branching with [ELSE_post].

Nesting

Shortcode nesting within is NOT supported.

Examples

Returns the value of the field post_title for the post with id 1234:

[mbr_post id='1234' field='post_title']

API

For direct use in PHP code use the structure as illustrated here:

$my_excerpt = mbr_page( array( 'id'=>'1234', 'field'=>'post_excerpt' ) );