Skip to content

Commit c3f5b48

Browse files
committed
Improve product price block
1 parent d920db4 commit c3f5b48

File tree

8 files changed

+7
-15
lines changed

8 files changed

+7
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ziorwebdev/wordpress-blocks",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "A collection of custom Gutenberg blocks designed to extend the WordPress block editor with icons, dynamic data, and flexible content composition.",
55
"type": "library",
66
"autoload": {

dist/blocks/editor.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/blocks/main.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/blocks/main.min.js

Whitespace-only changes.

dist/vendors.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/blocks/product-price/save.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ export default function Save({ attributes }: SaveProps) {
5757
});
5858

5959
return (
60-
<HtmlTag {...props}>
61-
<RichText.Content value={content} />
62-
</HtmlTag>
60+
<HtmlTag {...props}><span data-zior-placeholder-price></span></HtmlTag>
6361
);
6462
}

src/Blocks/ProductPrice/Block.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ public function render( $attributes, $content, $block ) {
5656

5757
$product = wc_get_product( $product_id );
5858
$price = $product->get_price_html();
59-
6059
$content = preg_replace(
61-
'~(<(h[1-6]|p|div|span)\b[^>]*\bclass=(["\'])[^"\']*\bwp-block-zior-product-price\b[^"\']*\3[^>]*>)(.*?)(</\2>)~is',
62-
'$1' . $price . '$5',
60+
'~<(h[1-6]|p|div|span)\b[^>]*\bdata-zior-placeholder-price(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|[^\s>]+))?\b[^>]*>\s*</\1>~i',
61+
$rating_html,
6362
$content,
6463
1
6564
);

src/Blocks/ProductPrice/block.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@
3939
}
4040
},
4141
"supports": {
42-
"align": [
43-
"wide",
44-
"full"
45-
],
46-
"anchor": true,
42+
"align": false,
43+
"anchor": false,
4744
"className": true,
4845
"splitting": true,
4946
"__experimentalBorder": {

0 commit comments

Comments
 (0)