Shortcode Exec PHP Shortcode Plugin
Attention! The plugin has become insecure and there is a lot of information on the Internet about infecting sites through it.. I suggest learning how to create shortcodes without plugins in my tutorial “Creating shortcodes - lesson 30“. I left the review article for review, I hope that the developers will close the security holes.
All who have worked with WordPress and installed plugins most likely came across a tool such as shortcode. The importance of this tool cannot be overestimated., it is enough to write the code once and it can be used inside the text of articles many times. In addition to the convenience of using shortcodes, they also help protect CMS from hacks.. Ask how? Everything is simple. WordPress initially cleans the text of articles from php code, to prevent unprivileged users from causing trouble. With shortcodes created, users will be able to use certain functions without using php code.
The problem is that initially, to create a shortcode, you need to open the file function.php and write special code in it, it takes a lot of time. To speed up the creation of your shortcodes, you can install the plugin Shortcode Exec PHP. Let's look at the screenshot, what does the plugin look like:
You can disable or allow the use of shortcodes in the sidebar, in release, in comments, in rss feeds. When working with this plugin, the basics of programming in php you will still need. Consider an example, which offers the plugin after installation.
Example 1
1 2 3 4 |
extract(shortcode_atts(array('arg' => 'default'), $atts)); echo "Hello world!" . PHP_EOL; echo "Arg=" . $arg . PHP_EOL; echo "Content=" . $content . PHP_EOL; |
Example 2
1 |
[hello_world arg="param"]Contents[/hello_world] |
hello_world – shortcode name;
arg – attribute shortcode, using this attribute, you can pass data to the created function from the Example 1.
What we will enter between the shortcodes (Example 2) will go into the variable $content (Example 1).
In the latest versions, you can export and import shortcodes to a file. Think, plugin would be helpful, good luck in developing quality websites.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.