Add PHP code to your WordPress posts, pages, custom post types and even sidebars using shortcodes
PHP Code for posts allows you to add your own PHP code to posts, pages, custom post types (posts) and even sidebars without the need for custom templates
The plugin enables a shortcode and options page so you can add your code to the admin options page and then output it in your post using shortcodes
Multiple code snippets can be used on a post, and multiple posts can use the same code snippet, allowing you to re-use code.
The shortcodes can be used to also display plain HTML content, allowing you to add in iframe, objects, areas and other tags that are removed by the post editor
The plugin also contains a variable array which you can add variables to for use between snippets called $_var and is available though the global variable $PHPPC which is an object, so its $PHPPC->_vars
The plugin's shortcode can also accept parameters using the param attribute, the value should be a string of name=value pairs, separated by &s, for example
[php snippet=2 param="var1=val1&var2=val2"]. Within your snippet, the parameters are assigned a $_parameters array, for example
echo $_parameters["var1"]; //outputs "val1"
The plugin's snippet editor now has better formatting, and supports AJAX saving for snippet updates (request by eneasgesing)
My special thanks go out to the following contributors: Vailou Gbr
Requires: 3.3.1 or higher
Compatible up to: 3.8.1
Last Updated: 2014-2-8
3 of 6 support threads in the last two months have been resolved.
Got something to say? Need help?