diff --git a/src/data.php b/src/data.php index 48c31b6..c18fe4c 100644 --- a/src/data.php +++ b/src/data.php @@ -94,10 +94,11 @@ function handle_do_block( array $block, $post_id = 0 ) { */ function get_attribute( $attribute, $html, $post_id = 0 ) { $value = null; - $dom = pQuery::parseStr( trim( $html ) ); - $node = isset( $attribute['selector'] ) ? $dom->query( $attribute['selector'] ) : $dom->query(); if ( isset( $attribute['source'] ) ) { + $dom = pQuery::parseStr( trim( $html ) ); + $node = isset( $attribute['selector'] ) ? $dom->query( $attribute['selector'] ) : $dom->query(); + switch ( $attribute['source'] ) { case 'attribute': $value = $node->attr( $attribute['attribute'] );