artemsemkin

Untitled

Oct 20th, 2020
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.38 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Theme functions and definitions.
  4.  * This child theme was generated by Merlin WP.
  5.  *
  6.  * @link https://developer.wordpress.org/themes/basics/theme-functions/
  7.  */
  8.  
  9. /*
  10. * If your child theme has more than one .css file (eg. ie.css, style.css, main.css) then
  11. * you will have to make sure to maintain all of the parent theme dependencies.
  12. *
  13. * Make sure you're using the correct handle for loading the parent theme's styles.
  14. * Failure to use the proper tag will result in a CSS file needlessly being loaded twice.
  15. * This will usually not affect the site appearance, but it's inefficient and extends your page's loading time.
  16. *
  17. * @link https://codex.wordpress.org/Child_Themes
  18. */
  19. add_action(  'wp_enqueue_scripts', 'rhye_child_enqueue_styles', 60 );
  20. function rhye_child_enqueue_styles() {
  21.   wp_enqueue_style( 'rhye-style' , get_template_directory_uri() . '/style.css' );
  22.   wp_enqueue_style( 'rhye-child-style',
  23.     get_stylesheet_directory_uri() . '/style.css',
  24.     array( 'rhye-style' ),
  25.     wp_get_theme()->get('Version')
  26.   );
  27.  
  28.   // TEST: remove Elementor's frontend on WooCommerce pages
  29.   if ( is_realy_woocommerce_page() ) {
  30.       wp_dequeue_script( 'elementor-frontend' );
  31.       wp_dequeue_style( 'elementor-frontend' );
  32.       wp_deregister_script( 'elementor-frontend' );
  33.       wp_deregister_style( 'elementor-frontend' );
  34.   }
  35. }
  36.  
  37. /**
  38. * is_realy_woocommerce_page - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and which are also included)
  39. *
  40. * @access public
  41. * @return bool
  42. */
  43. function is_realy_woocommerce_page () {
  44.     if( function_exists ( "is_woocommerce" ) && is_woocommerce()){
  45.         return true;
  46.     }
  47.     $woocommerce_keys = array ( "woocommerce_shop_page_id" ,
  48.         "woocommerce_terms_page_id" ,
  49.         "woocommerce_cart_page_id" ,
  50.         "woocommerce_checkout_page_id" ,
  51.         "woocommerce_pay_page_id" ,
  52.         "woocommerce_thanks_page_id" ,
  53.         "woocommerce_myaccount_page_id" ,
  54.         "woocommerce_edit_address_page_id" ,
  55.         "woocommerce_view_order_page_id" ,
  56.         "woocommerce_change_password_page_id" ,
  57.         "woocommerce_logout_page_id" ,
  58.         "woocommerce_lost_password_page_id" ) ;
  59.  
  60.     foreach ( $woocommerce_keys as $wc_page_id ) {
  61.         if ( get_the_ID () == get_option ( $wc_page_id , 0 ) ) {
  62.             return true ;
  63.         }
  64.     }
  65.     return false;
  66. }
Add Comment
Please, Sign In to add comment