shortcode_unautop [ WordPress Function ]
shortcode_unautop ( $pee )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: shortcode_atts, do_shortcode_tag, do_shortcode, strip_shortcode_tag, add_shortcode
Don't auto-p wrap shortcodes that stand alone
Ensures that shortcodes are not wrapped in <
>...<
.
Source
<?php
function shortcode_unautop( $pee ) {
global $shortcode_tags;
if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {
return $pee;
}
$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
$pattern =
'/'
. '<p>' // Opening paragraph
. '\\s*+' // Optional leading whitespace
. '(' // 1: The shortcode
. '\\[' // Opening bracket
. "($tagregexp)" // 2: Shortcode name
. '\\b' // Word boundary
// Unroll the loop: Inside the opening shortcode tag
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. '(?:'
. '\\/(?!\\])' // A forward slash not followed by a closing bracket
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. ')*?'
. '(?:'
. '\\/\\]' // Self closing tag and closing bracket
. '|'
. '\\]' // Closing bracket
. '(?:' // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
. '[^\\[]*+' // Not an opening bracket
. '(?:'
. '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
. '[^\\[]*+' // Not an opening bracket
. ')*+'
. '\\[\\/\\2\\]' // Closing shortcode tag
. ')?'
. ')'
. ')'
. '\\s*+' // optional trailing whitespace
. '<\\/p>' // closing paragraph
. '/s';
return preg_replace( $pattern, '$1', $pee );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- shortcode_unautop() should also remove the - WordPress Trac
Currently wpautop() wraps a shortcode in <p> tags as well as adding a <br /> tag after the shortcode. We then use shortcode_unautop() to remove the <p> tags, ...
core.trac.wordpress.org - WordPress › Support » Tags — shortcode_unautop
Forums. Username or Email Address Password (forgot?) Register · WordPress › Support » shortcode_unautop. Tag: shortcode_unautop Add New » ...
wordpress.org - shortcode_unautop | A HitchHackers guide through WordPress
Feb 12, 2011 ... function shortcode_unautop($pee) { global $shortcode_tags; if ( !empty($ shortcode_tags) && is_array($shortcode_tags) ) { $tagnames ...
hitchhackerguide.com - using shortcodes everywhere | sillybean.net
Feb 13, 2010 ... I think that the shortcode_unautop has been deprecated under 2.9.2 which ... It also checks for the existence of shortcode_unautop before ...
sillybean.net
Kullanýcý Tartýþmalarý [ wordpress.org ]
- CrazySerb on "formatting.php:shortcode_unautop() empties the post"
- Covi on "Shortcodes are wrapped in paragraph tags"
- a.andrianov on "formatting.php:shortcode_unautop() empties the post"
- alexbalint on "Shortcodes are wrapped in paragraph tags"
- relish1227 on "Shortcodes are wrapped in paragraph tags"
- sheeptastic on "Shortcodes are wrapped in paragraph tags"