Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Optimize WooCommerce Scripts
- * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
- */
- add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
- function child_manage_woocommerce_styles() {
- //remove generator meta tag
- remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
- //first check that woo exists to prevent fatal errors
- if ( function_exists( 'is_woocommerce' ) ) {
- //dequeue scripts and styles
- if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
- wp_dequeue_style( 'woocommerce_frontend_styles' );
- wp_dequeue_style( 'woocommerce_fancybox_styles' );
- wp_dequeue_style( 'woocommerce_chosen_styles' );
- wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
- wp_dequeue_script( 'wc_price_slider' );
- wp_dequeue_script( 'wc-single-product' );
- wp_dequeue_script( 'wc-add-to-cart' );
- wp_dequeue_script( 'wc-cart-fragments' );
- wp_dequeue_script( 'wc-checkout' );
- wp_dequeue_script( 'wc-add-to-cart-variation' );
- wp_dequeue_script( 'wc-single-product' );
- wp_dequeue_script( 'wc-cart' );
- wp_dequeue_script( 'wc-chosen' );
- wp_dequeue_script( 'woocommerce' );
- wp_dequeue_script( 'prettyPhoto' );
- wp_dequeue_script( 'prettyPhoto-init' );
- wp_dequeue_script( 'jquery-blockui' );
- wp_dequeue_script( 'jquery-placeholder' );
- wp_dequeue_script( 'fancybox' );
- wp_dequeue_script( 'jqueryui' );
- }
- }
- }
- add_filter('do_not_defer','scripts_to_not_defer');
- function scripts_to_not_defer(){
- return array('jquery', 'cycle');
- }
- /* Verhindert das Laden von emoji.js. Von hier: https://wordpress.org/support/topic/emoji-and-smiley-js-and-css-added-to-head
- */
- remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
- remove_action( 'wp_print_styles', 'print_emoji_styles' );
- /**
- * Diese Funktionen zwingt die Funktion wp_mail (über php Mailer) SMTP zu verwenden.
- * von hier: http://www.flippercode.com/send-html-emails-using-wp-mail-wordpress/ (noch nicht eingepflaumt)
- * von hier: http://www.butlerblog.com/2011/07/08/changing-the-wp_mail-from-address-in-wordpress-without-a-plugin/
- * von hier: http://www.butlerblog.com/2013/12/12/easy-smtp-email-settings-for-wordpress/
- **/
- add_filter( 'wp_mail_from', 'my_mail_from' );
- function my_mail_from( $email )
- {
- return "[email protected]";
- }
- add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
- function my_mail_from_name( $name )
- {
- return "Gleitschirm-Flugschule Magiclift";
- }
- /**
- * Erzeugt im WooCommerce-Shop ein "Preis auf Anfrage" bei leerem Preisfeld
- **/
- add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
- function custom_call_for_price() {
- return 'Preis auf Anfrage';
- }
- global $avia_config;
- /**
- * Verhindert Probleme zwischen Events Manager und Enfold
- * http://www.kriesi.at/support/topic/events-manager/**/
- $avia_config['g_maps_widget_active'] = 1;
- $avia_map_prefix = isset($_SERVER['HTTPS'] ) ? "https" : "http";
- wp_register_script( 'avia-google-maps-api', $avia_map_prefix.'://maps.google.com/maps/api/js?key=AIzaSyClKhnVf5PihM7M5aCuqeZu4sV3Mx5YuhQ');
- wp_enqueue_script( 'avia-google-maps-api' );
- /**
- * Dieser Code ermöglicht es, den Ubuntu-Font fürs Frontend auszuwählen
- **/
- add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
- function avia_add_heading_font($fonts)
- {
- $fonts['Ubuntu'] = 'Ubuntu';
- return $fonts;
- }
- add_filter( 'avf_google_content_font', 'avia_add_content_font');
- function avia_add_content_font($fonts)
- {
- $fonts['Ubuntu'] = 'Ubuntu';
- return $fonts;
- }
- add_theme_support('avia_conditionals_for_mega_menu');
- add_theme_support('avia_template_builder_custom_css');
- /**
- * Dieser Code ermöglicht eine Fancybox -
- * Für Mail-Form auf Produkteseiten
- * von hier: http://www.kriesi.at/support/topic/contact-form-in-pop-up-prettyphoto-issue/#post-304173
- **/
- function popup_inline() { ?>
- <script type="text/javascript">
- jQuery(window).load(function(){
- jQuery('.open-popup-link').magnificPopup({
- type:'inline',
- midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
- });
- });
- </script>
- <?php }
- add_action('wp_head', 'popup_inline');
- /**
- * Dieser Code macht Social Icons auf Produktseiten sichtbar
- * von hier: http://www.kriesi.at/support/topic/social-buttons-on-woocommerce-product-pages/
- **/
- add_action('woocommerce_after_single_product_summary', 'avia_add_social_toolbar', 10, 2);
- function avia_add_social_toolbar($id = "", $context = "")
- {
- avia_social_share_links();
- }
- /**
- * Dieser Code ermöglicht eine Anpassung im Webshop für Enfold -
- * von hier: http://www.kriesi.at/documentation/enfold/custom-woocommerce-shop-overview/
- **/
- add_theme_support( 'avia_custom_shop_page' );
- /**
- * Dieser Code ermöglicht Links in Images mit Hotspots -
- * von hier: http://www.kriesi.at/documentation/enfold/custom-woocommerce-shop-overview/
- **/
- add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
- function avia_include_shortcode_template($paths)
- {
- $template_url = get_stylesheet_directory();
- array_unshift($paths, $template_url.'/shortcodes/');
- return $paths;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement