=== Post Content Shortcodes === Contributors: cgrymala Tags: shortcode, clone, syndication, post content, post list Requires at least: 3.0 Tested up to: 3.2.1 Stable tag: 0.2 Adds shortcodes to display the content of a post or a list of posts. == Description == This plugin adds two shortcodes that allow you to display either the content of a post or a list of posts within the content area of a post. This plugin should be fully compatible with all post types, as it simply uses the `get_post()` and `get_posts()` WordPress functions. **Post Content** The first shortcode is the `[post-content]` shortcode. Using that shortcode will allow you to display the content of one post within another post. This shortcode requires a single attribute with a key of "id". To use this shortcode to display the content of a post or page with an ID of 25, you would use this shortcode like `[post-content id=25]`. **Post List** The second shortcode is the `[post-list]` shortcode. This shortcode does not require any arguments, but will accept the following arguments (most of which are the default arguments used with `get_posts()`): * numberposts => -1 * offset => 0 * category => null * orderby => post_title * order => asc * include => null * exclude => null * meta_key => null * meta_value => null * post_type => 'post' * post_mime_type => null * post_parent => null * post_status => 'publish' * exclude_current => true The last argument shown is not a standard argument for the `get_posts()` function. It is a custom argument for this plugin. When that argument is set to `true`, the current page or post will be excluded from the list of posts. If it is set to `false`, `"false"` or `0`, the current page or post will be included in the post list. To read more about the other arguments, please [visit the codex page for the `get_posts()` function](http://codex.wordpress.org/Function_Reference/get_posts). If you are looking to display a list of attachments in a post, rather than displaying a list of posts or pages, you might want to check out the [List Attachments Shortcode plugin](http://wordpress.org/extend/plugins/list-attachments-shortcode/) instead. == Installation == = Automatic Installation = The easiest way to install this plugin automatically from within your administration area. 1. Go to Plugins -> Add New in your administration area, then search for the plugin "Post Content Shortcodes". 1. Click the "Install" button. 1. Go to the Plugins dashboard and "Activate" the plugin (for MultiSite users, you can safely "Network Activate" this plugin). = Manual Installation = If that doesn't work, or if you prefer to install it manually, you have two options. **Upload the ZIP** 1. Download the ZIP file from the WordPress plugin repository. 1. Go to Plugins -> Add New -> Upload in your administration area. 1. Click the "Browse" (or "Choose File") button and find the ZIP file you downloaded. 1. Click the "Upload" button. 1. Go to the Plugins dashboard and "Activate" the plugin (for MultiSite users, you can safely "Network Activate" this plugin). **FTP Installation** 1. Download the ZIP file from the WordPress plugin repository. 1. Unzip the file somewhere on your harddrive. 1. FTP into your Web server and navigate to the /wp-content/plugins directory. 1. Upload the post-content-shortcodes folder and all of its contents into your plugins directory. 1. Go to the Plugins dashboard and "Activate" the plugin (for MultiSite users, you can safely "Network Activate" this plugin). = Must-Use Installation = If you would like to **force** this plugin to be active (generally only useful for Multi Site installations) without an option to deactivate it, you can upload the post-content-shortcodes.php to your /wp-content/mu-plugins folder. If that folder does not exist, you can safely create it. Make sure **not** to upload the post-content-shortcodes *folder* into your mu-plugins directory, as "Must Use" plugins must reside in the root mu-plugins directory in order to work. == Frequently Asked Questions == = Does the shortcode output any extra HTML? = The `[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. The `[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> ` = How do I change the HTML output for the post-list? = There are some filters available within the plugin that can alter the HTML generated by the shortcode. Those filters are as follows: * **post-content-shortcodes-open-list** - filters the opening '<ul>' tag * **post-content-shortcodes-open-item** - filters the opening '<li>' tag * **post-content-shortcodes-item-link-open** - filters the opening '<a>' tag. Three parameters are available with this filter. The constructed '<a>' tag is sent as the first parameter, the permalink is the second and the title attribute is the third. The 'the_permalink' filter is applied to the permalink before it is sent or used, and the 'the_title_attribute' filter is applied to the title attribute before it is sent or used. * **post-content-shortcodes-item-link-close** - filters the closing '</a>' tag * **post-content-shortcodes-close-item** - filters the closing '</li>' tag * **post-content-shortcodes-close-list** - filters the closing '</ul>' tag = Are there any other filters in the plugin? = Yes. * If the `[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-no-posts-error` filter. * If you would like to use a different set of default values for the shortcode arguments, you can hook into the `post-content-shortcodes-defaults` filter. The array of default arguments is passed to that filter before it gets used. * If you would like to alter the output of the `[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-content` filter. The constructed HTML output is passed as the first parameter, and the WordPress post object is passed as a second parameter. == Changelog == = 0.2 = * Attempted to fix issue with original readme file (no info from readme was showing up in the WordPress repo) = 0.1a = This is the first version of this plugin