_product_attributes
$args = [
'post_type' => 'product',
'meta_query' => [
[
'key' => '_product_attributes',
'value' => 'blue',
]
]
];
$query = new WP_Query($args);
<Product>
<SKU>10027105</SKU>
<Brand_Name>Adidas</Brand_Name>
<Product_Name>Adidas Mens Climacool Boat Lace Shoes - Sale</Product_Name>
<Long_Description>...</Long_Description>
<Short_Description>...</Short_Description>
<Category>Footwear</Category>
<SubCategory>Casual</SubCategory>
<Product_Group>Men's</Product_Group>
<Thumb_URL>...</Thumb_URL>
<Image_URL>...</Image_URL>
<Buy_Link>...</Buy_Link>
<Retail_Price>74.99</Retail_Price>
<Sale_Price>59.99</Sale_Price>
<Extended_Xml_Attributes>
<variants>
<variant>
<sku>19301</sku>
<upc>0886833708180</upc>
<size>8</size>
<color>Dark Indigo</color>
<retail_price>74.99</retail_price>
<sale_price>59.99</sale_price>
<action_url>...</action_url>
</variant>
<variant/>
...
</variants>
</Extended_Xml_Attributes>
</Product>
function wpp_change_svg_img_color( $url, $color ) {
$content = file_get_contents( $url );
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->loadXML( $content ) or die( 'Failed to load SVG ' . $url );
$paths = $doc->getElementsByTagName( "path" );
foreach ( $paths as $path ) {
$path->setAttribute( 'fill', $color );
$path->setAttribute( 'style', 'fill:' . $color );
$content = $doc->saveXML( $doc );
}
return $content;
}
$url = the_post_thumbnail_url( 'full' ); // url миниатюры
$color = '#000000'; #нужный вам цвет
printf( '<img src="%s" alt="">', wpp_change_svg_img_color( $url, $color) );