Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_shortcode_content($shorcode, $post = '', $all = 'id|name', $get = '')
- {
- if(empty($post))
- {
- global $post;
- }
- $pattern = get_shortcode_regex();
- if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
- && array_key_exists( 2, $matches )
- && in_array( $shorcode, $matches[2] ) )
- {
- preg_match_all('/(' . $all . ')=("[^"]*")/i', trim($matches[3][0]), $all_shortcode_settings);
- if(!empty($all_shortcode_settings))
- {
- if(!empty($get))
- {
- $id_index = -1;
- foreach($all_shortcode_settings[1] as $attribute_index => $attribute)
- {
- if($attribute == $get)
- {
- $id_index = $attribute_index;
- break;
- }
- }
- if( ($id_index >= 0) && (!empty($all_shortcode_settings[2][$id_index])) )
- {
- return $all_shortcode_settings[2][$id_index];
- }
- }
- return $all_shortcode_settings;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement