InScript
InScript is an extensible scripting framework that provides the capability to insert and modify data without needing to modify any WordPress files.
At the simplest level, it is a generic pattern matcher – it searches for specific patterns, or tags, and replaces them with something else. However, instead of replacing these patterns with static text, you can replace them with variables, functions, and even PHP code.
Some of the features that InScript provides are:
- Dynamic variables, which can be used in many places and are automatically updated (the version and last updated details above are dynamic variables)
- Disable WordPress texturize functions across the whole blog, individual posts, or even individual words
- Conversely, enable texturize, textile, markdown, or any formatting on individual posts or words
- Embed well-defined scripts inside posts and any other part of WordPress, without modifying the theme
The embedded scripts are very powerful, and allow you to do things like:
- Insert post & author information
- Add HTTP meta-values and make them post-specific
- Customise the appearance of words, paragraphs, or posts
- Change date formats on individual sections
- Insert highlighted code
- Insert custom PHP code
- Add custom stylesheets for specific posts
Because of the extensible nature of the plugin, you can add ‘scriptlets’ (mini-plugins) that provide extra features and yet use the same InScript framework.
Here are the current scriptlets:
- rss-link-list.zip - embed RSS feeds in conjunction with the rssLinkList plugin (which must be installed and enabled)
- pinyin-converter.zip - Pinyin converter allows Chinese pinyin to be inserted in the form zhong1guo2 and converted to the correct tonal version of %%lang_pinyin [text=zhong1guo2]%%
Note: install scriptlets into the /wp-content/plugins/inscript/scripts directory.
No really, what does it do?
The best way to explain what InScript does is by providing examples. Note that these examples are provided 'live' by InScript.
Example 1 – Code highlighting
Often you want to highlight some code within a post. This creates several problems:
- Code uses special characters that interfere with HTML
- WordPress mangles a lot of the characters
- It’s a chore to color the code by hand
We can insert an InScript tag to do all this for us.
And this produces:
Example 2 – Blog title & description
Notice anything special about the title of this page? No? Okay, go and look at it again. Yes, that's right, it's different from the rest of the blog. This is because of these two custom fields:
inscript_option_blogname = SuburbanGiraffe
More fun
Of course, all of these are simplistic examples. Separate plugins already exist to achieve many of the functions described here. The point is that InScript gives you the ability to perform these functions anywhere in your blog, using just one syntax and one plugin. Additionally, you can customise the output exactly as you want, using a wider range of functions. You can cook up all sorts of madness – now, who’s for colour-highlighted code in their title?
Before I finish, here are some more live functions:
- Word shuffle - %%str_shuffle [text=my old man is a dustman and he likes giraffes]%%
- Reverse - %%str_reverse [text=hello world and welcome to my plugin]%%
- Rot13 - %%str_rot13 [text=hello world and welcome to my plugin]%%
- Leet - %%str_leet [text=hello world and welcome to my plugin]%%
- Email obsfucator - %%str_obscure_email [email=test.email@example.com]%%
- System info - %%system_os%% %%system_release%% %%system_version%% %%system_machine%%
- Time since - this page was created
(as opposed to %%post_date%%) - PHP version - %%php_version%%
- HTTP agent - your browser is %%http_agent%%
- WordPress version - %%blog_version%%
And here's the WordPress calendar function embedded into a post:






Comments (page 10 of 11)
May 11, 2007 9:09 am
Hi John,
how can I integrate different post excerpts within a post and let them rotate by random or with a timer which changes the displayed excerpts e.g. every hour?
This function does not work, I dont know why ...
%%post_excerpt [url=/index.php/!!randomexcerpts!!/]%%
Best regards
Dirk
May 3, 2007 4:15 am
Thanks Stephen, very appreciated!
Dirk, can you repost the code with escaped HTML, or send it in an email? WordPress ate most of it!
Apr 28, 2007 5:02 pm
Hi John,
how can I integrate different post excerpts within a post and let them rotate by random?
Can I call a function with a function for this purpose?
The following solution doesn't work with the %%post_excerpt%% variable:
but it works with e.g. %%post_title%%.
What can I do?
Apr 28, 2007 2:07 am
Thanks John - works like a dream. Have made a small donation.
Apr 27, 2007 12:07 pm
Perfect! Thank you again, John!
Apr 27, 2007 1:19 am
Dirk & Stephen: Try version 1.7.2. I've removed the need to create a file, thus removing any problems with file permissions.
Apr 24, 2007 12:48 pm
Hi John,
with WP 2.1 it works fine!
But with WP 2.1.3. (different project) I have same problem as Neil and stephen ..
Best regards
Dirk
Mar 27, 2007 9:20 am
Same issue - permissions are set as 644 files and 755 directories (with phpsuexec), and auto.php won't auto create. Wont' work with 777. Is there a workaround? Thanks...
Mar 16, 2007 3:42 am
Nell, did you give permissions to all the subdirectories? auto.php is created for you, and if it doesnt have permissions then it cant create it.
Mar 4, 2007 5:53 am
I cannot download any scriptys you have they all goto 'page not found'
Please advise...
Leave a comment