From cd914a53b397c63758c0318d93b6f5bbafc1f85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Kj=C3=A6rgaard?= Date: Tue, 25 Jun 2024 11:04:24 +0200 Subject: [PATCH] Create pQuery if source isset on --- src/data.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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'] );