dvadf
File manager - Edit - /home/theblueo/www/wp-content/themes/thebos/framework/theme/theme_hook.php
Back
<?php function nimbus_custom_body_class( $classes ) { $nb_header_style = nimbus_meta_data('radio_header_style') ? nimbus_meta_data('radio_header_style') : nimbus_option_data('select_header_style','','top'); $classes[] = 'nb-header-'.$nb_header_style; if( nimbus_option_data('switch-fixed-preloader')) $classes[] = 'nb-site-preloader'; $nb_footer_fixed = nimbus_meta_data('select_footer_fixed') ? nimbus_meta_data('select_footer_fixed') : nimbus_option_data('switch_footer_fixed'); if ( $nb_footer_fixed ) $classes[] = 'nb-footer-fixed'; return $classes; } add_filter( 'body_class', 'nimbus_custom_body_class' ); function nimbus_custom_post_class( $classes ) { if ( is_sticky() ) $classes[] = 'sticky'; return $classes; } add_filter( 'post_class', 'nimbus_custom_post_class' ); function nb_theme_meta_name() { echo '<meta name="generator" content="Nimbus" />'; } add_action('wp_head', 'nb_theme_meta_name',5); function nb_theme_site_logo() { $nb_black_logo_url = nimbus_option_data('media_main_logo','url',get_theme_file_uri( '/assets/images/logo.png')); $nb_white_logo_url = nimbus_option_data('media_white_logo','url',get_theme_file_uri( '/assets/images/logo-white.png')); $nb_logo_size = nimbus_option_data('dimensions_logo'); $nb_title_tag = (is_home() || is_front_page() ) ? 'h1' : 'p'; echo '<'.$nb_title_tag.' class="nb-site-title"> <a href="'.esc_url( home_url( '/' ) ).'" rel="home"> <span class="site-title">'.get_bloginfo( 'name' ).'</span> <span class="site-description">'.get_bloginfo( 'description' ).'</span> <img class="black-logo" src="'.esc_url( $nb_black_logo_url ).'" alt="'.get_bloginfo( 'name' ).'"> <img class="white-logo" src="'.esc_url( $nb_white_logo_url ).'" alt="'.get_bloginfo( 'name' ).'"> </a> </'.$nb_title_tag.'>'; } add_action( 'nb-site-logo','nb_theme_site_logo' ); function nb_theme_footer_site_logo() { $nb_black_logo_url = nimbus_option_data('media_main_logo','url',get_theme_file_uri( '/assets/images/logo.png')); $nb_white_logo_url = nimbus_option_data('media_white_logo','url',get_theme_file_uri( '/assets/images/logo-white.png')); $nb_logo_size = nimbus_option_data('dimensions_logo'); echo '<span class="nb-site-title"> <a href="'.esc_url( home_url( '/' ) ).'" rel="home"> <img class="black-logo" src="'.esc_url( $nb_black_logo_url ).'" alt="'.get_bloginfo( 'name' ).'"> <img class="white-logo" src="'.esc_url( $nb_white_logo_url ).'" alt="'.get_bloginfo( 'name' ).'"> </a> </span>'; } add_action( 'nb-site-footer-logo','nb_theme_footer_site_logo' ); function nb_theme_site_menu() { $nb_header_style = nimbus_meta_data('radio_header_style') ? nimbus_meta_data('radio_header_style') : nimbus_option_data('select_header_style','','top'); $nb_header_style = $nb_header_style == 'side' ? 'nb-slide-nav' : 'nb-main-nav'; if ( has_nav_menu('main') ) { wp_nav_menu( array( 'theme_location' => 'main', 'container' => 'ul', 'menu_class' => $nb_header_style, 'before' => '<span class="nb-menu-title">', 'after' => '</span>', ) ); } } add_action( 'nb-site-main-menu','nb_theme_site_menu' ); function nb_theme_site_footer_menu() { if ( has_nav_menu('footer') ) { wp_nav_menu( array( 'theme_location' => 'footer', 'container' => 'ul', 'menu_class' => 'nb-footer-nav', 'before' => '<span class="nb-menu-title">', 'after' => '</span>', ) ); } } add_action( 'nb-site-footer-menu','nb_theme_site_footer_menu' ); function nb_theme_mobile_menu_trigger() { ?> <div class="desktop-menu-trigger nb-mobile-menu-action nb-col-xs-6 nb-visible-xs nb-visible-sm"> <div class="hamburger"> <div class="hamburger-box"> <div class="hamburger-inner"></div> </div> </div> </div> <?php } add_action( 'nb-site-mobile-trigger','nb_theme_mobile_menu_trigger' ); function nb_theme_header_info() { $nb_theme_header_info = nimbus_meta_data('text_header_information') ? nimbus_meta_data('text_header_information') : nimbus_option_data('select_header_menu_action'); if ( $nb_theme_header_info ) { ?> <div class="nb-site-info"> <div class="nb-inner-content"> <?php echo do_shortcode( nimbus_validate_data($nb_theme_header_info) );?> </div> </div> <?php } } add_action( 'nb-site-header-info','nb_theme_header_info' ); function nb_theme_custom_heading() { ?> <div class="nb-custom-heading"> <div class="nb-container"> <div class="nb-row nb-table"> <div class="nb-col-md-6"><?php do_action( 'nb_custom_heading_left' );?></div> <div class="nb-col-md-6 nb-text-right"><?php do_action( 'nb_custom_heading_right' );?></div> </div> </div> </div> <?php } add_action( 'nimbus_custom_woo_heading','nb_theme_custom_heading' ); function nb_theme_heading_left_content() { $menu = nimbus_meta_data('radio_heading_menu'); if ( $menu == '' || $menu == 'breadcrumbs' ) { if ( function_exists( 'nimbus_theme_breadcrumb') ) nimbus_theme_breadcrumb(); } else { wp_nav_menu( array( 'menu' => $menu, 'container' => 'ul', 'menu_class' => 'nb-heading-nav', 'before' => '<span class="nb-menu-title">', 'after' => '</span>', ) ); } } add_action( 'nimbus_heading_left','nb_theme_heading_left_content' ); function nb_theme_social_link() { ?> <div class="nb-site-social"> <ul> <?php $social = nimbus_option_data('multi_text_social_media'); if ( isset( $social ) && $social ): foreach ( $social as $social_link ): $icon_name = nimbus_get_social_domain_name($social_link); ?> <li class="social-<?php echo esc_attr($icon_name);?>"><a href="<?php echo esc_url($social_link);?>"><i class="social_<?php echo esc_attr($icon_name);?>"></i></a></li> <?php endforeach;endif; ?> </ul> </div> <?php } add_action( 'nimbus_site_social','nb_theme_social_link' ); function nb_theme_custom_header_script() { echo nimbus_option_data('ace_editor_custom_css'); } add_action( 'wp_head','nb_theme_custom_header_script' ); function nb_theme_custom_footer_script() { echo nimbus_option_data('ace_editor_custom_js'); } add_action( 'wp_footer','nb_theme_custom_footer_script' ); function nb_theme_custom_menu_item ( $items, $args ) { if ( $args->theme_location == 'main' && in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { $items .= '<li class="nb-cart"><span><a href="'.wc_get_cart_url().'" title="'.esc_attr__( 'View your shopping cart','nimbus' ).'">'.esc_attr__( 'Cart', 'nimbus' ).'<span class="nb-cart-count">'.sprintf ( _n( '%d', '%d', WC()->cart->get_cart_contents_count(), 'nimbus' ), WC()->cart->get_cart_contents_count() ).'</span></a></span></li>'; } return $items; } add_filter( 'wp_nav_menu_items', 'nb_theme_custom_menu_item', 10, 2 ); function nb_wpdocs_custom_excerpt_length( $length ) { return nimbus_option_data('text_excerptlength','',15); } add_filter( 'excerpt_length', 'nb_wpdocs_custom_excerpt_length', 999 ); function nb_theme_body_class( $class ) { $arr = array( 'msie', 'firefox', 'webkit', 'opera' ); $agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); foreach( $arr as $name ) { if( strpos( $agent, $name ) > -1 ) { $class[] = $name; preg_match( '/' . $name . '[\/|\s](\d)/i', $agent, $matches ); if ( $matches[1] ) $class[] = $name . '-' . $matches[1]; return $class; } } return $class; } add_filter( 'body_class', 'nb_theme_body_class' ); function nb_theme_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> <li class="nb-cart"> <span><a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" title="<?php _e('View your shopping cart', 'nimbus'); ?>"><?php echo esc_attr__( 'Cart', 'nimbus' );?><span class="nb-cart-count"><?php echo sprintf(_n('%d', '%d', $woocommerce->cart->cart_contents_count, 'nimbus'), $woocommerce->cart->cart_contents_count);?></span></a></span> <ul class="nb_header_cart_list"> <?php if ( ! WC()->cart->is_empty() ) : ?> <?php foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) ) { $product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ); $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); ?> <li class="<?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '<a href="%s" class="remove" title="%s" data-product_id="%s" data-product_sku="%s">×</a>', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), esc_attr__( 'Remove this item', 'nimbus' ), esc_attr( $product_id ), esc_attr( $_product->get_sku() ) ), $cart_item_key ); ?> <?php if ( ! $_product->is_visible() ) : ?> <?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . ' '; ?> <?php else : ?> <a href="<?php echo esc_url( $product_permalink ); ?>"> <?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . ' '; ?> </a> <?php endif; ?> <?php echo WC()->cart->get_item_data( $cart_item ); ?> <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?> </li> <?php } } ?> <?php else : ?> <li class="empty"><?php _e( 'No products in the cart.', 'nimbus' ); ?></li> <?php endif; ?> <?php if ( ! WC()->cart->is_empty() ) : ?> <li class="nb-cart-footer"> <p class="total"><strong><?php _e( 'Subtotal', 'nimbus' ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p> <?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?> <p class="buttons"> <a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="button nb-button wc-forward"><?php _e( 'View Cart', 'nimbus' ); ?></a> <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="button nb-button checkout wc-forward"><?php _e( 'Checkout', 'nimbus' ); ?></a> </p> </li> <?php endif; ?> </ul><!-- end product list --> </li> <?php $fragments['li.nb-cart'] = ob_get_clean(); return $fragments; } add_filter('add_to_cart_fragments', 'nb_theme_header_add_to_cart_fragment');
dvadf
dvadf
| ver. 1.4 |
Github
|
.
| PHP 7.0.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings