Created
October 28, 2017 20:34
-
-
Save oskosk/9b48dad71c910c59f6feadd479f70b25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package HTML Shortcodes | |
* @version 1.0 | |
*/ | |
/* | |
Plugin Name: Rational SHortcodes | |
Author: Osk | |
*/ | |
add_filter( 'the_content', function( $content ) { | |
echo "titania\n"; | |
$matcher = '/((?:<div|(?<!^)\G)\h*(?:data-shortcode)(?:="([^"]*)")*(.*?\/>))/'; | |
$regexp = '/(?:<div|(?<!^)\G)\h*(data-[\w-]+)(?:="([^"]*)")*(?=.*?\/>)/'; | |
$match = array(); | |
$match2 = array(); | |
$matches = array(); | |
preg_match_all( $regexp , $content, $match ); | |
preg_match( $matcher , $content, $match2 ); | |
var_dump($match2); | |
if ( ! empty( $match ) ) { | |
$matches = array_combine( $match[1], $match[2]); | |
} | |
if ( ! empty( $matches ) ) { | |
// var_dump( $match[0] ) ; | |
var_dump( $matches ) ; | |
} | |
return $content; | |
// Before do_shortcode | |
}, 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment