https://github.com/webdeveric/get-post-content-shortcode
This plugin provides a shortcode to get the content of a post based on ID number.
https://github.com/webdeveric/get-post-content-shortcode
post-content shortcode wordpress
Last synced: 2 months ago
JSON representation
This plugin provides a shortcode to get the content of a post based on ID number.
- Host: GitHub
- URL: https://github.com/webdeveric/get-post-content-shortcode
- Owner: webdeveric
- Created: 2014-09-21T00:26:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T14:29:50.000Z (almost 8 years ago)
- Last Synced: 2025-01-12T09:12:40.094Z (4 months ago)
- Topics: post-content, shortcode, wordpress
- Language: PHP
- Homepage: https://wordpress.org/plugins/get-post-content-shortcode/
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Get Post Content Shortcode
[](https://travis-ci.org/webdeveric/get-post-content-shortcode)
This WordPress plugin provides a shortcode to get the content of a post based on ID number.
## Usage
`[post-content id="42"]`
This gets the content of post 42.
`[post-content id="42" autop="false"]`
This gets the content of post 42 and does not call wpautop on the content.
`[post-content id="42" shortcode="false"]`
This gets the content of post 42 and does not call do_shortcode on the content.
`[post-content id="42" autop="false" shortcode="false"]`
This gets the content of post 42 and does not call wpautop or do_shortcode on the content.
`[post-content id="42" status="publish,future"]`
This gets the content of post 42 only if the post_status is "publish" or "future".
`[post-content id="42" field="excerpt"]`
This gets the excerpt of post 42.
## Filter examples
**Only allow the `post_content` field**
```php
add_filter('post-content-allowed-fields', function($allowed_fields) {
return [ 'post_content' ];
});
```**Set the default value of the `autop` attribute to `false`**
```php
add_filter('post-content-default-attributes', function ($default_attributes) {
return [ 'autop' => false ];
});
```## Tests
[setup instructions](http://wp-cli.org/docs/plugin-unit-tests/)
`vendor/bin/phpunit`