Simple Shortcodes Support Posted bymbaker5153 28 December 200815 July 2019 8 Comments on Simple Shortcodes Support If you have any comments or questions about Simple Shortcodes, please leave a comment on this post.
I really like Simple Shortcodes. I did make a few quick changes though after install.
I had to set the simple_shortcodes.value varchar higher (and related maxlength to admin input). Luckily I have MySQL 5.0.32 to support this, although I guess a work-around for pre-5.0.3 would be to string together shortcodes, e.g. [ccbyncsa1][ccbyncsa2].
The other change I made was to use single-quotes on the value attribute of SS_value. I use double-quotes for most of my coding so maybe this is a personal preference.
Either way, nice plugin. I like the easy ones.
Thank you for your comments.
As a result I have increased the size of simple_shortcodes.value to LONGTEXT in the new version (0.2) which I released earlier today.
Overall, your plugin works exactly as expected and seems to fill one of the few major holes in WP’s feature set. However I have run into some problems. I created two shortcodes called [test] and . They both caused the whole WordPress site to stop working with error messages like:
Parse error: syntax error, unexpected ‘[‘, expecting T_STRING in /home/website/public_html/draco/wp-content/plugins/simple-shortcodes/MB_SS_Handler.php on line 37
I got the site back up by deleting the offending entry in MB_SS_Handler.php and dropping the database table, but that solution is a lot of extra work; if you run into this same problem, it’s easier to simply delete the MB_SS_Handler.php outright via FTP or an online file manager and then delete the shortcode causing the problem via the configuration page in WordPress.
On the up side, I did discover that you can fool the plugin into recreating its own database table by advancing the version number found in simple_shortcodes.php. In this case, I changed $plugin_db_version from 0.3 to 0.4 and everything worked fine.
On a lesser note, the configuration screen is one of the plugin’s weaknesses. Changing the vertical size of the value field results in things looking a little odd: the name field is always centered, vertically, relative to the value field.
Inline documentation could also be improved. I had to refer to the readme to be certain what the option values referred to (I didn’t want to try them out without knowing, though I had my theory). I also was initially unclear about what “Display HTML Markup” did. The documentation in the readme is clear; the inline documentation is less so.
Thank you for your feedback. Its very valuable for the next release which I’m currently working on.
The next release will test to ensure that invalid characters are not allowed in shortcode names. In the meantime only use letters, digits, “-” and “_” in shortcode names.
Also in the mean time if you want to regenerate the database table I’d strongly suggest not incrementing $plugin_db_version. Rather change it to anything else. The danger is if you increment it and choose the next number that I increment it to for the next release your database table won’t update on the next release. My suggestion is either change it to something like 0.3A or 0.3.1 or “some random text”. The test used is are the saved and current version numbers different strings.
I have installed s-shortcode on two WP blogs on the same domain and same database. Database #1 is biz_ and #2 is montage_. I would like to use the same s-shortcode tables for both, say from biz_simple_shortcode tables in both WP blogs. I changed the code in simple_shortcodes.php as follows;
// $this->db_table_name = $wpdb->prefix . “simple_shortcodes”;
$this->db_table_name = “biz_simple_shortcodes”;
It allows me to edit but it does not show up in the post. Can this work and if so what am I missing? Thanks in advance for your help, I love the plugin.
I never considered having two WP blogs in the same database when I designed simple_shortcodes. I’m not sure what will happen. Each time that the shortcodes are modified, they are written to a file (MB_SS_Handler.php) in the same directory that simple_shortcodes.php is located.
The MB_SS_Handler.php file is the missing link for me to accomplish the sharing between blogs (I hope). The plugin in recognized in two blogs in that I can edit the database tables from either blog, but the MB_SS_Handler.php is local, so I need to figure out how to use only one copy across the blogs or how to update the file from the database each time the blog is opened. Your plugin is great and I want to use it to have global values that I can use in multiple blogs. Since the blogs all use the same database I hope to make simlpe mods to your plugin to get a lift from the global simple shortcodes. Thanks again for your help.
When I was designing simple_shortcodes I considered having the shortcode handler read the shortcodes from the database rather than creating a static file with the shortcodes (MB_SS_Handler.php). This (having the handler read the shortcodes from the database) would probably be a better approach than re-writting the handler file everytime.
Leave a comment