Define your own custom dynamic text replacement pseudo-functions (i.e. ::google(«search terms here»)::)
This plugin serves a different need than the Text Replace plugin (also written by me). Dynamic Text Replace allows you to easily pre-define text replacement template strings and allow for text to be passed in.
It comes preloaded with pseudo-functions that facilitate making links to: amazon.com, answers.com, codex.wordpress.org, google.com, imdb.com, and wikipedia.com. The beauty is that you can create your own very easily!
::amazon(«ASIN/ISBN goes here», «What you want as the link text»)::
::answers(«dictionary word or search terms go here», «Link text here»)::
::codex(«Use Custom Fields», «Learn how to use custom fields»)::
::google(«Search terms go here», «Link text here»)::
::imdb(«Search terms go here», «Link text here»)::
::wikipedia(«Search terms here», «Link text here»)::
In all cases, the second argument is optional. If not provided, the first argument will also be used as the link text. Double-quoting of arguments isn’t required, though it is recommended.
An Admin options page for the plugin greatly faciliates creation of new dynamic text replacements and also provides further documentation. In a nutshell, dynamic shortcuts are defined like:
amazon => <a href='http://www.amazon.com/exec/obidos/ASIN/%text%'>%display%</a>
%text% represents the first argument to the pseudo-function.
%display% represents the second argument to the pseudo-function
%text_altered% (used in the other preloaded dynamic shortcuts) is used when the first argument has been altered, which is handled in a special section of the plugin that you’d have to modify yourself if it is a feature you intend to utilize
- Download the file dynamic-text-replace.zip and unzip it into your /wp-content/plugins/ directory.
Copy and paste the the code ( dynamic-text-replace.phps ) into a file called dynamic-text-replace.php, and put that file into your /wp-content/plugins/ directory. Please ensure you do not introduce any spaces or other characters before the <?php or after the ?>
- Activate the plugin from your WordPress admin ‘Plugins’ page.
- In WordPress’s Admin section, click the Options tab. Then click the «Dynamic Text Replace» subtab. Define new
text replacement pseudo-functions according to the instructions and using the preloaded examples for reference.
- Use the shortcuts in a post.
function c2c_dynamic_text_replace( $text )
- $text : Text to be scanned for dynamic shortcuts
(See notes section above)
- 30 Mar 2005 : v0.9.1 —
- Options page for the plugin now viewable for users with userlevel of 8 or higher.
- Removed inadvertantly left behind debugging output code.
- 29 Mar 2005 : v0.9 — Released to the public
Copyright (c) 2005 by Scott Reilly (aka coffee2code)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the «Software»), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED «AS IS», WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.