in-product discovery - enqueue styles as separate module

This commit is contained in:
haszari 2019-02-13 12:18:39 +13:00
parent 8151f28c79
commit 42852d7b67
5 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1 @@
.marketplace-suggestions-container{text-align:center;margin-top:2em}

View File

@ -0,0 +1 @@
.marketplace-suggestions-container{text-align:center;margin-top:2em}

View File

@ -0,0 +1,10 @@
/**
* marketplace-suggestions.scss
* Styling for in-product marketplace suggestions.
*/
.marketplace-suggestions-container {
text-align: center;
margin-top: 2em;
}

View File

@ -40,12 +40,14 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION );
wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), WC_VERSION );
wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print' );
wp_register_style( 'woocommerce_admin_marketplace_styles', WC()->plugin_url() . '/assets/css/marketplace-suggestions.css', array(), WC_VERSION );
// Add RTL support for admin styles.
wp_style_add_data( 'woocommerce_admin_menu_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_dashboard_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_print_reports_styles', 'rtl', 'replace' );
wp_style_add_data( 'woocommerce_admin_marketplace_styles', 'rtl', 'replace' );
// Sitewide menu CSS.
wp_enqueue_style( 'woocommerce_admin_menu_styles' );
@ -70,6 +72,10 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
do_action( 'woocommerce_admin_css' );
wc_deprecated_function( 'The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts' );
}
if ( in_array( $screen_id, array( 'edit-product' ), true ) ) {
wp_enqueue_style( 'woocommerce_admin_marketplace_styles' );
}
}

View File

@ -13,6 +13,5 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<div class="marketplace-suggestions-container"
data-marketplace-suggestions-context="<?php echo esc_attr( $context ); ?>"
style="text-align: center; margin-top: 2em"
>
</div>