Skip to content

Commit

Permalink
Add selector keyword support
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Sep 12, 2024
1 parent 158a165 commit 04f709d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions classes/ppom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ function inline_css() {

if ( $this->ppom_settings->productmeta_style != '' ) {
$inline_css = stripslashes( strip_tags( $this->ppom_settings->productmeta_style ) );
$inline_css = str_replace( 'selector', ".ppom-id-$this->meta_id", $inline_css );
}

return apply_filters( 'ppom_inline_css', $inline_css, $this );
Expand Down
6 changes: 3 additions & 3 deletions templates/admin/ppom-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$send_file_attachment = ( isset( $ppom_settings->send_file_attachment ) ? $ppom_settings->send_file_attachment : '' );
$show_cart_thumb = ( isset( $ppom_settings->show_cart_thumb ) ? $ppom_settings->show_cart_thumb : '' );
$aviary_api_key = ( isset( $ppom_settings->aviary_api_key ) ? $ppom_settings->aviary_api_key : '' );
$productmeta_style = ! empty( $ppom_settings->productmeta_style ) ? $ppom_settings->productmeta_style : ".ppom-id-$product_meta_id {\n}\n";
$productmeta_style = ! empty( $ppom_settings->productmeta_style ) ? $ppom_settings->productmeta_style : "selector {\n}\n";
$productmeta_js = ( isset( $ppom_settings->productmeta_js ) ? $ppom_settings->productmeta_js : '' );
$productmeta_categories = ( isset( $ppom_settings->productmeta_categories ) ? $ppom_settings->productmeta_categories : '' );
$product_meta = json_decode( $ppom_settings->the_meta, true );
Expand Down Expand Up @@ -199,9 +199,9 @@ class="dashicons dashicons-editor-help"></i></span>
</label>
<textarea id="ppom-css-editor" class="form-control" name="productmeta_style"><?php echo wp_unslash( $productmeta_style ); ?></textarea>
<br>
<p><?php esc_html_e( 'Use', 'woocommerce-product-addon' ); ?> <code>.ppom-id-<?php echo (int) $product_meta_id; ?></code> <?php esc_html_e( 'to target block wrapper.', 'woocommerce-product-addon' ); ?></p>
<p><?php esc_html_e( 'Use', 'woocommerce-product-addon' ); ?> <code>selector</code> <?php esc_html_e( 'to target block wrapper.', 'woocommerce-product-addon' ); ?></p>
<p><?php esc_html_e( 'Example:', 'woocommerce-product-addon' ); ?></p>
<pre className="ppom-css-editor-help"><?php echo esc_html( ".ppom-id-$product_meta_id {\n background: #000;\n}\n.ppom-id-$product_meta_id img {\n border-radius: 100%;\n}" ); ?></pre>
<pre className="ppom-css-editor-help"><?php echo esc_html( "selector {\n background: #000;\n}\nselector img {\n border-radius: 100%;\n}" ); ?></pre>
<p><?php esc_html_e( 'You can also use other CSS syntax here, such as media queries.', 'woocommerce-product-addon' ); ?></p>
</div>
</div>
Expand Down

0 comments on commit 04f709d

Please sign in to comment.