add_shortcode [ WordPress Function ]
| Parameters: |
|
| Uses: |
|
| Defined at: |
|
Add hook for shortcode tag.
There can only be one hook for each shortcode. Which means that if another plugin has a similar shortcode, it will override yours or yours will override theirs depending on which order the plugins are included and/or ran.
Simplest example of a shortcode tag using the API:
// [footag foo="bar"]
function footag_func($atts) {
return "foo = {$atts[foo]}";
}
add_shortcode('footag', 'footag_func');
Example with nice attribute defaults:
// [bartag foo="bar"]
function bartag_func($atts) {
extract(shortcode_atts(array(
'foo' => 'no foo',
'baz' => 'default baz',
), $atts));
return "foo = {$foo}";
}
add_shortcode('bartag', 'bartag_func');
Example with enclosed content:
// [baztag]content[/baztag]
function baztag_func($atts, $content='') {
return "content = $content";
}
add_shortcode('baztag', 'baztag_func');
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- add_shortcode - WordPress Codex
<?php add_shortcode( $tag , $func ); ?> ... function footag_func($atts) { return " foo = {$atts[foo]}"; } add_shortcode('footag', 'footag_func');. Example with nice ...
codex.wordpress.org - Shortcode API « WordPress Codex
The `add_shortcode()` function is used to register a shortcode handler. It takes two parameters: the shortcode name (the string used in a post body), and the ...
codex.wordpress.org - WP First Aid | add_shortcode
Sep 21, 2010 ... In January 2010 I wrote a post about making a template tag for standard plugins using the built-in WordPress function the_widget(). This post ...
wpfirstaid.com - add_shortcode (WordPress Function) - WPSeek.com
WordPress lookup for add_shortcode, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com
Kullanýcý Tartýþmalarý [ wordpress.org ]
- mmtomm on "add_shortcode in functions.php output in wrong order"
- alchymyth on "add_shortcode in functions.php output in wrong order"
- mmtomm on "add_shortcode in functions.php output in wrong order"
- glaxton on "List of all Shortcodes Created with add_shortcode"
- consumedesign on "add_shortcode question, arrays"
- dnboxster on "Shortcode challenge"
- toneburst on "add_shortcode and Post ID"
- toneburst on "add_shortcode and Post ID"
- scibuff on "multiple shortcode tags only every other parsed"
- azahi on "add_shortcode problem!"