f( $parallax == 'stellar' ){ wp_enqueue_script( 'jquery-stellar', THEME_URI. '/js/parallax/stellar.js', false, THEME_VERSION, true ); } // scripts config ----------------------------- mfn_scripts_config(); wp_enqueue_script( 'jquery-scripts', THEME_URI. '/js/scripts.js', false, THEME_VERSION, true ); // singular | comment reply if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } } } add_action('wp_enqueue_scripts', 'mfn_scripts'); /* --------------------------------------------------------------------------- * Scripts | Custom JS * --------------------------------------------------------------------------- */ if( ! function_exists( 'mfn_scripts_custom' ) ) { function mfn_scripts_custom() { if( $custom_js = mfn_opts_get( 'custom-js' ) ){ echo ''."\n"; echo ''."\n"; } } } add_action('wp_footer', 'mfn_scripts_custom', 100); /* --------------------------------------------------------------------------- * Retina logo * --------------------------------------------------------------------------- */ if( ! function_exists( 'mfn_retina_logo' ) ) { function mfn_retina_logo() { // logo - source ------------------------- if( $layoutID = mfn_layout_ID() ){ $logo_src = get_post_meta( $layoutID, 'mfn-post-retina-logo-img', true ); $logo_sticky = get_post_meta( $layoutID, 'mfn-post-sticky-retina-logo-img', true ) ? get_post_meta( $layoutID, 'mfn-post-sticky-retina-logo-img', true ) : $logo_src; $logo_mobile = get_post_meta( $layoutID, 'mfn-post-responsive-retina-logo-img', true ) ? get_post_meta( $layoutID, 'mfn-post-responsive-retina-logo-img', true ) : $logo_src; } else { $logo_src = mfn_opts_get( 'retina-logo-img' ); $logo_sticky = mfn_opts_get( 'sticky-retina-logo-img' ) ? mfn_opts_get( 'sticky-retina-logo-img' ) : $logo_src; $logo_mobile = mfn_opts_get( 'responsive-retina-logo-img' ) ? mfn_opts_get( 'responsive-retina-logo-img' ) : $logo_src; } if( $logo_src || $logo_sticky ){ echo ''."\n"; echo ''."\n"; } } } add_action('wp_head', 'mfn_retina_logo'); /* --------------------------------------------------------------------------- * Scripts config * --------------------------------------------------------------------------- */ if( ! function_exists( 'mfn_scripts_config' ) ) { function mfn_scripts_config() { echo ''."\n"; echo ''."\n"; } } /* --------------------------------------------------------------------------- * Adds classes to the array of body classes. * --------------------------------------------------------------------------- */ // header style --------------------------------- if( ! function_exists( 'mfn_header_style' ) ) { function mfn_header_style( $firstPartOnly = false ){ $header_layout = false; if( $_GET && key_exists('mfn-h', $_GET) ){ $header_layout = $_GET['mfn-h']; // demo } elseif( $layoutID = mfn_layout_ID() ){ $header_layout = get_post_meta( $layoutID, 'mfn-post-header-style', true ); } elseif( mfn_opts_get('header-style') ){ $header_layout = mfn_opts_get('header-style'); } if( strpos( $header_layout, ',' ) ){ // multiple header parameters $a_header_layout = explode( ',', $header_layout ); // return only First Parameter if( $firstPartOnly ) return 'header-'.$a_header_layout[0]; foreach( (array)$a_header_layout as $key => $val ){ $a_header_layout[$key] = 'header-'. $val; } $header = implode(' ', $a_header_layout); } else { // one parameter $header = 'header-'. $header_layout; } return $header; } } // sidebar classes ------------------------------ if( ! function_exists( 'mfn_sidebar_classes' ) ) { function mfn_sidebar_classes( $has_both = false ) { $classes = $both = false; if( mfn_ID() ){ if( get_post_type() == 'page' && mfn_opts_get('single-page-layout') ){ // Theme Options | Single - Page $layout = mfn_opts_get('single-page-layout'); } elseif( get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout') ){ // Theme Options | Single - Post $layout = mfn_opts_get('single-layout'); } elseif( get_post_type() == 'portfolio' && is_single() && mfn_opts_get('single-portfolio-layout') ){ // Theme Options | Single - Portfolio $layout = mfn_opts_get('single-portfolio-layout'); } else { // Post Meta $layout = get_post_meta( mfn_ID(), 'mfn-post-layout', true); } switch ( $layout ) { case 'left-sidebar': $classes = ' with_aside aside_left'; break; case 'right-sidebar': $classes = ' with_aside aside_right'; break; case 'both-sidebars': $classes = ' with_aside aside_both'; $both = true; break; } // demo if( $_GET && key_exists('mfn-s', $_GET) ){ if( $_GET['mfn-s'] ){ $classes = ' with_aside aside_right'; } else { $classes = false; } } } // WooCommerce if( function_exists('is_woocommerce') ){ if( is_woocommerce() ){ if( ! isset( $layout ) || ! $layout ){ // BeTheme version < 6.4 | DO NOT DELETE if( is_active_sidebar( 'shop' ) ) $classes = ' with_aside aside_right'; } elseif( $layout == 'both-sidebars' ){ // Only one sidebar for shop $classes = ' with_aside aside_right'; } } if( is_product() && mfn_opts_get('shop-sidebar') == 'shop' ){ $classes = false; } } // bbPress if( function_exists('is_bbpress') && is_bbpress() && is_active_sidebar( 'forum' ) ){ $classes = ' with_aside aside_right'; } // BuddyPress if( function_exists('is_buddypress') && is_buddypress() && is_active_sidebar( 'buddy' ) ){ $classes = ' with_aside aside_right'; } // Easy Digital Downloads if( ( get_post_type() == 'download' ) && is_active_sidebar( 'edd' ) ){ $classes = ' with_aside aside_right'; } // Events Calendar if( function_exists('tribe_is_month') && is_active_sidebar( 'events' ) ){ if( tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue() ){ $classes = ' with_aside aside_right'; } } // Page Template: Blank Page, Under Construction if( is_page_template( 'template-blank.php' ) || is_page_template( 'under-construction.php' ) ){ $classes = false; } // check if has both sidebars if( $has_both ) return $both; return $classes; } } // body classes --------------------------------- if( ! function_exists( 'mfn_body_classes' ) ) { function mfn_body_classes( $classes ) { // Layout | Custom ------------------------------------ $layoutID = mfn_layout_ID(); if( $layoutID ) $classes[] = 'lay-id-'. $layoutID; // Slider --------------------------------------------- if( mfn_slider() ) $classes[] = 'template-slider'; // Sidebar -------------------------------------------- $classes[] = mfn_sidebar_classes(); // Skin ----------------------------------------------- if( $_GET && key_exists('mfn-c', $_GET) ){ $classes[] = 'color-'. $_GET['mfn-c']; // demo } elseif( $layoutID ){ $classes[] = 'color-'. get_post_meta( $layoutID, 'mfn-post-skin', true ); } else { $classes[] = 'color-'. mfn_opts_get('skin','custom'); } // Style | Default & Simple --------------------------- if( $_GET && key_exists('mfn-style', $_GET) ){ $classes[] = 'style-'. $_GET['mfn-style']; // demo } else { $classes[] = 'style-'. mfn_opts_get( 'style', 'default' ); } // Layout | Full Width & Boxed ------------------------ if( $_GET && key_exists('mfn-box', $_GET) ){ $classes[] = 'layout-boxed'; // demo } elseif( $layoutID ){ $classes[] = 'layout-'. get_post_meta( $layoutID, 'mfn-post-layout', true ); } else { $classes[] = 'layout-'. mfn_opts_get('layout','full-width'); } // Layout | Boxed to Full Width on mobile ------------- if( mfn_opts_get( 'responsive-boxed2fw' ) ){ $classes[] = 'boxed2fw'; } // One Page ------------------------------------------- if( get_post_meta( mfn_ID(), 'mfn-post-one-page', true ) ){ $classes[] = 'one-page'; } // Nice Scroll ---------------------------------------- if( mfn_opts_get('nice-scroll') ) $classes[] = 'nice-scroll-on'; // Responsive ----------------------------------------- if( mfn_opts_get('no-hover') ) $classes[] = 'no-hover-'. mfn_opts_get('no-hover'); if( mfn_opts_get('no-section-bg') ) $classes[] = 'no-section-bg-'. mfn_opts_get('no-section-bg'); if( mfn_opts_get('responsive-top-bar') ) $classes[] = 'mobile-tb-'. mfn_opts_get('responsive-top-bar'); $responsive_options = mfn_opts_get( 'responsive-options' ); if( is_array( $responsive_options ) && isset( $responsive_options['mobile-wide'] ) ){ $classes[] = 'mobile-wide'; } // Button | Style ------------------------------------- if( $_GET && key_exists('mfn-btn', $_GET) ){ $classes[] = 'button-'. $_GET['mfn-btn']; // demo } elseif( mfn_opts_get('button-style') ){ $classes[] = 'button-'. mfn_opts_get('button-style'); } // Image Frame | Style -------------------------------- if( $_GET && key_exists('mfn-if', $_GET) ){ $classes[] = 'if-'. $_GET['mfn-if']; // demo } elseif( mfn_opts_get('image-frame-style') ){ $classes[] = 'if-'. mfn_opts_get('image-frame-style'); } // Image Frame | Border ------------------------------- if( mfn_opts_get('image-frame-border') ){ $classes[] = 'if-border-'. mfn_opts_get('image-frame-border'); } // Content Padding ------------------------------------ if( mfn_opts_get('content-remove-padding') ){ $classes[] = 'no-content-padding'; } elseif( get_post_meta( mfn_ID(), 'mfn-post-remove-padding', true ) ){ $classes[] = 'no-content-padding'; } // Single Template ------------------------------------ if( get_post_meta( mfn_ID(), 'mfn-post-template', true ) ){ $classes[] = 'single-template-'. get_post_meta( mfn_ID(), 'mfn-post-template', true ); } // RTL | demo only ------------------------------------ if( $_GET && key_exists('mfn-rtl', $_GET) ) $classes[] = 'rtl'; // Love ----------------------------------------------- if( ! mfn_opts_get('love') ) $classes[] = 'hide-love'; // Table Hover ---------------------------------------- if( mfn_opts_get('table-hover') ) $classes[] = 'table-hover'; // Header ============================================= $header_options = mfn_opts_get('header-fw') ? mfn_opts_get('header-fw') : false; // Header | Layout -------------------------- $classes[] = mfn_header_style(); // Header | Full Width ---------------------- if( $_GET && key_exists('mfn-hfw', $_GET) ){ $classes[] = 'header-fw'; // demo } elseif( isset( $header_options['full-width'] ) ){ $classes[] = 'header-fw'; } // Header | Boxed --------------------------- if( is_array( $header_options ) && isset( $header_options['header-boxed'] ) ){ $classes[] = 'header-boxed'; } // Header | Minimalist ---------------------- if( $_GET && key_exists('mfn-min', $_GET) ){ $classes[] = 'minimalist-header'; // demo } elseif( $layoutID ){ if( get_post_meta( $layoutID, 'mfn-post-minimalist-header', true ) == 'no' ){ $classes[] = 'minimalist-header-no'; } elseif( get_post_meta( $layoutID, 'mfn-post-minimalist-header', true ) ){ $classes[] = 'minimalist-header'; } } elseif( mfn_opts_get('minimalist-header') == 'no' ) { $classes[] = 'minimalist-header-no'; } elseif( mfn_opts_get('minimalist-header') ) { $classes[] = 'minimalist-header'; } // Header | Sticky -------------------------- if( mfn_opts_get('sticky-header') && ( mfn_header_style( true ) != 'header-creative' ) ){ $classes[] = 'sticky-header'; } // Header Sticky Style ---------------------- if( $_GET && key_exists('mfn-ss', $_GET) ){ $classes[] = 'sticky-'. $_GET['mfn-ss']; // demo } elseif( $layoutID ){ $classes[] = 'sticky-'. get_post_meta( $layoutID, 'mfn-post-sticky-header-style', true ); } else { $classes[] = 'sticky-'. mfn_opts_get('sticky-header-style','white'); } // Action Bar ------------------------------- if( mfn_opts_get('action-bar') ){ $classes[] = 'ab-show'; } else { $classes[] = 'ab-hide'; } // Subheader | Transparent ------------------ $skin = mfn_opts_get( 'skin', 'custom' ); if( $_GET && key_exists('mfn-subtr', $_GET) ){ $classes[] = 'subheader-transparent'; // demo } elseif( ! in_array( $skin, array('custom','one') ) ){ if( mfn_opts_get( 'subheader-transparent' ) != 100 ){ $classes[] = 'subheader-transparent'; } } // Subheader | Style ------------------------ if( $_GET && key_exists('mfn-sh', $_GET) ){ $classes[] = 'subheader-'. $_GET['mfn-sh']; // demo } else { $classes[] = 'subheader-'. mfn_opts_get('subheader-style','title-left'); } // Menu | Style ----------------------------- if( $_GET && key_exists('mfn-m', $_GET) ){ $classes[] = 'menu-'. $_GET['mfn-m']; // demo } elseif( mfn_opts_get('menu-style') ) { $classes[] = 'menu-'. mfn_opts_get('menu-style'); } // Menu | Options --------------------------- $menu_options = mfn_opts_get( 'menu-options' ); if( is_array( $menu_options ) && isset( $menu_options['align-right'] ) ){ $classes[] = 'menuo-right'; } if( is_array( $menu_options ) && isset( $menu_options['menu-arrows'] ) ){ $classes[] = 'menuo-arrows'; } if( is_array( $menu_options ) && isset( $menu_options['hide-borders'] ) ){ $classes[] = 'menuo-no-borders'; } if( is_array( $menu_options ) && isset( $menu_options['last'] ) ){ $classes[] = 'menuo-last'; } // Footer =================================================== // Footer | Style --------------------------- if( $_GET && key_exists('mfn-ftr', $_GET) ){ $classes[] = 'footer-'. $_GET['mfn-ftr']; // demo } elseif( mfn_opts_get('footer-style') ) { $classes[] = 'footer-'. mfn_opts_get('footer-style'); } // Footer | Copy & Social ------------------- if( mfn_opts_get( 'footer-hide' ) == 'center' ) { $classes[] = 'footer-copy-center'; } // Transparent ============================================== $transparent_options = mfn_opts_get( 'transparent' ); if( is_array( $transparent_options ) ){ if( isset( $transparent_options['header'] ) ){ $classes[] = 'tr-header'; } if( isset( $transparent_options['menu'] ) ){ $classes[] = 'tr-menu'; } if( isset( $transparent_options['content'] ) ){ $classes[] = 'tr-content'; } if( isset( $transparent_options['footer'] ) ){ $classes[] = 'tr-footer'; } } if( mfn_opts_get( 'responsive-tr-header' ) ){ $classes[] = 'mobile-tr-header'; } return $classes; } } add_filter( 'body_class', 'mfn_body_classes' ); /* --------------------------------------------------------------------------- * Annoying styles remover * --------------------------------------------------------------------------- */ if( ! function_exists( 'mfn_remove_recent_comments_style' ) ) { function mfn_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } } add_action( 'widgets_init', 'mfn_remove_recent_comments_style' ); ?>