>
post_content;
$pattern = get_shortcode_regex();
preg_match( "/$pattern/s", $content, $match );
if( isset( $match[2] ) && ( "gallery" == $match[2] ) ) {
$atts = shortcode_parse_atts( $match[3] );
$attachments = isset( $atts['ids'] ) ? explode( ',', $atts['ids'] ) : get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . get_the_id() .'&order=ASC&orderby=menu_order ID' );
}
if ($attachments) {?>
'ids' ));
$query_custom = new WP_Query(
array( "tag__in" => $posttags,
"orderby" => 'rand',
"showposts" => 3,
"post__not_in" => array(get_the_id())
) );
if ($query_custom->have_posts()) : ?>