About Wordpress like Shortcodes
It brings Wordpress like shortcodes to Processwire.
Category | Markup Generation Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin). |
---|---|
Release State | Stable Should be safe for use in production environments. * |
Author | |
Module Version | 1.04 |
Class Name | MarkupShortcodes |
Compatibility | 2.4, 2.5, 2.6, 2.7 |
Date Added | September 26, 2012 |
Last Updated | May 7, 2015 |
Recommended By | New recommendations may take up to 1 day to appear. |
Instructions
W A R N I N G:
This Module requires PHP 5.3
This module's files should be placed in /site/modules/MarkupShortcodes/
How to install or uninstall modules
---
A quick example:
Code:
<?php$shortcode = $modules->get('MarkupShortcodes');
$shortcode->add('login', function($atts){
return '<form><h3>'.$atts['content'].'</h3><label>Enter password for "'.$atts['name'].'":</label> <input type="pass"></form>';
});
$content = 'Lorem ipsum dolor [login name="user"]Login[/login]';
echo $shortcode->render($content);
?>
You can:
add a shortcode:
Code:
$shortcode->add('login', function($atts){return '<form><h3>'.$atts['content'].'</h3><label>Enter password for "'.$atts['name'].'":</label> <input type="pass"></form>';
});
remove a shortcode:
Code:
$shortcode->remove('login');
remove all shortcodes:
Code:
$shortcode->remove_all();
and use them:
Code:
$shortcode->render('Lorem [ipsum /] hello. [dolor name="nico" /]. Third possibility: [abc def="hij"]a text[/abc]. ');
As seen above there are three different possible syntaxes:
Code:
1.: [shortcode] or [shortcode /]2.: [shortcode key="value" /] or [shortcode key="value"] or [shortcode key="value" second="bla" /]
3.: [shortcode]lorem ipsum[/shortcode] or [shortcode key="value"]lorem ipsum[/shortcode] or [shortcode key="value" second="bla"]lorem ipsum[/shortcode]
README
Comments
No comments yet. Be the first to post!
Post a Comment
Your e-mail is kept confidential and not included with your comment. Website is optional.
- Admin Helpers
- Core Modules
- Development Tools
- Field Types
- File Validator
- Import/Export
- Input Fields
- Language Modules
- Language Packs
- Logs/Monitoring
- Markup Generation
- Photo/Video/Audio
- Premium Modules
- Process Modules
- Proof of Concept
- SEO/Accessibility
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
Disclaimer
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.