conflict with storefront
-
hello, I copied and pasted strofront theme’ s woocommerce card code to my theme’s function.php. if I set action, elementor conflict with my theme.Elementor edit screen doesn’t start, you know long time waiting.
the problematic action:
add_action( ‘init’, ‘storefront_header_cart’, 60 );you are more familiar the code from me so I hope you will find a good solution.
full snippet:
if ( ! function_exists( 'storefront_woo_cart_available' ) ) { /** * Validates whether the Woo Cart instance is available in the request * * @since 2.6.0 * @return bool */ function storefront_woo_cart_available() { $woo = WC(); return $woo instanceof \WooCommerce && $woo->cart instanceof \WC_Cart; } } if ( ! function_exists( 'storefront_cart_link' ) ) { /** * Cart Link * Displayed a link to the cart including the number of items present and the cart total * * @return void * @since 1.0.0 */ function storefront_cart_link() { if ( ! storefront_woo_cart_available() ) { return; } ?> <a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>"> <?php /* translators: %d: number of items in cart */ ?> <?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) ); ?></span> </a> <?php } } if ( ! function_exists( 'storefront_header_cart' ) ) { /** * Display Header Cart * * @since 1.0.0 * @uses storefront_is_woocommerce_activated() check if WooCommerce is activated * @return void */ function storefront_header_cart() { { if ( is_cart() ) { $class = 'current-menu-item'; } else { $class = ''; } ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <?php } } } add_action( 'init', 'storefront_header_cart', 60 );
- The topic ‘conflict with storefront’ is closed to new replies.