Adds shortcodes to display the content of a post or a list of posts.
To display the content of a single post within another post, you want to use the
[post-content] shortcode. To display the content of the post with an ID of 25 and a slug of 'this-is-my-cool-post', the usage would look like:
To display a list of posts within another post, you want to use the
[post-list] shortcode. To display a list of all pages (post_type=page) on this site, the usage would look like:
By default, this plugin will display all posts that match the specified criteria (except for the current post). To limit the number of posts that are displayed, you should add the
numberposts argument to the shortcode. That would look like:
[post-list post_type="page" numberposts=15]
[post-content] shortcode will not output any extra HTML at all. It simply outputs the content of the page being cloned. The original title is not output, nor is any sort of wrapper HTML.
[post-list] shortcode, however, does output some HTML to actually format the list. The default HTML code output looks like:
<ul class="post-list"> <li class="listed-post"><a href="%permalink%" title="%title%">%title</a></li> </ul>
There are some filters available within the plugin that can alter the HTML generated by the shortcode. Those filters are as follows:
[post-list]shortcode retrieves an empty list of posts/pages, it will normally return an empty string (so as not to disrupt the flow of the page). However, you can have the shortcode output a custom error message by hooking into the
post-content-shortcodes-defaultsfilter. The array of default arguments is passed to that filter before it gets used.
[post-content]shortcode (for instance, to wrap it in an HTML container, or to add content before or after), you can hook into the
post-content-shortcodes-contentfilter. The constructed HTML output is passed as the first parameter, and the WordPress post object is passed as a second parameter.
[post-content]shortcode (if you are limiting the length of the content/excerpt), you can use the
post-content-shortcodes-read-morefilter to do so.
post-content-shortcodes-image-classto do that.
By default, the
[post-list] shortcode excludes the current post (since that would cause somewhat of a loop in the user's mind; clicking on a link in the page only to have the page reload with the same content). To allow the current post to be displayed in the list of posts, set the
exclude_current argument to
0. That might look something like:
blog attribute to specify which site/blog the post should be pulled from. The
blog attribute can accept a blog ID (numeric) or a blog name (the slug of the blog).
Yes. You can safely network-activate this plugin, or even use it as a mu-plugin. To pull a post with a slug of 'this-is-my-cool-post' from a blog with an ID of 10 and a slug of 'mycoolsite', the usage would look something like:
[post-content post_name="this-is-my-cool-post" blog=10]
[post-content post_name="this-is-my-cool-post" blog="mycoolsite"]
Yes. The way this plugin works, there is no distinction between multi-network & multisite. You can use the
blog_id argument to pull posts from any site in the entire multi-network installation; regardless of which network they fall under.
There is a known issue where HTML (especially [caption] shortcodes) within the excerpt can break the entire page. In order to avoid this, be sure to place the tag above the [caption] shortcode within the posts being pulled into the post-list shortcode.
Requires: 4.0 or higher
Compatible up to: 4.3.6
Last Updated: 1 year ago
Active Installs: 10,000+
Got something to say? Need help?