... in side body tag * --------------------------------------------------------------------------- */ add_action( 'wp_head', 'alagu_wp_head',999 ); if ( ! function_exists( 'alagu_wp_head' ) ) { function alagu_wp_head() { ob_start(); } } add_action( 'wp_footer', 'alagu_wp_footer',999 ); if ( ! function_exists( 'alagu_wp_footer' ) ) { function alagu_wp_footer() { $content = ob_get_clean(); $regex = "##"; preg_match($regex, $content, $matches); $style = isset($matches[0]) ? $matches[0] : ''; $content = str_replace($style,'',$content); $content = str_replace('',$style.'',$content); $regex = "##"; preg_match($regex, $content, $matches); $style = isset($matches[0]) ? $matches[0] : ''; $content = str_replace($style,'',$content); $content = str_replace('',$style.'',$content); echo "{$content}"; } } /* --------------------------------------------------------------------------- * Hook of Top * --------------------------------------------------------------------------- */ function alagu_hook_top() { if( alagu_get_option( 'enable-top-hook' ) ) : echo ''; $hook = alagu_get_option( 'top-hook' ); if (!empty($hook) ) echo do_shortcode( stripslashes($hook) ); echo ''; endif; } add_action( 'alagu_hook_top', 'alagu_hook_top', 10 ); /* --------------------------------------------------------------------------- * Page Loader * --------------------------------------------------------------------------- */ add_action( 'alagu_hook_top', 'alagu_page_loader', 20 ); function alagu_page_loader() { $loader = alagu_get_option( 'show-loader' ); if( $loader ) { echo '
'; } } /* --------------------------------------------------------------------------- * Hook of Content before * --------------------------------------------------------------------------- */ function alagu_hook_content_before() { if( alagu_get_option( 'enable-content-before-hook' ) ) : echo ''; $hook = alagu_get_option( 'content-before-hook' ); if (!empty($hook)) echo do_shortcode( stripslashes($hook) ); echo ''; endif; } add_action( 'alagu_hook_content_before', 'alagu_hook_content_before' ); /* --------------------------------------------------------------------------- * Hook of Content after * --------------------------------------------------------------------------- */ function alagu_hook_content_after() { if( alagu_get_option( 'enable-content-after-hook' ) ) : echo ''; $hook = alagu_get_option( 'content-after-hook' ); if (!empty($hook)) echo do_shortcode( stripslashes($hook) ); echo ''; endif; } add_action( 'alagu_hook_content_after', 'alagu_hook_content_after' ); /* --------------------------------------------------------------------------- * Main Header Hook * --------------------------------------------------------------------------- */ add_action( 'alagu_header', 'alagu_vc_header_template', 10 ); if( ! function_exists( 'alagu_vc_header_template' ) ) { function alagu_vc_header_template() { $id = ''; if( is_singular() && empty( $page_id ) ) { global $post; $settings = get_post_meta( $post->ID,'_dt_custom_settings',TRUE ); $settings = is_array( $settings ) ? $settings : array(); if( array_key_exists( 'show-header', $settings ) && !$settings['show-header'] ) return; $id = isset( $settings['header'] ) ? $settings['header'] : ''; $id = ( $id == '' ) ? alagu_get_option( 'site-custom-header' ) : $id; } elseif( !empty( $page_id ) ) { $settings = get_post_meta( $page_id, '_dt_custom_settings',TRUE ); $settings = is_array( $settings ) ? $settings : array(); if( array_key_exists( 'show-header', $settings ) && !$settings['show-header'] ) return; $id = isset( $settings['header'] ) ? $settings['header'] : ''; $id = ( $id == '' ) ? alagu_get_option( 'site-custom-header' ) : $id; } else { $id = alagu_get_option( 'site-custom-header' ); } $id = apply_filters( 'alagu_header_id', $id ); if( !$id || !function_exists( 'vc_lean_map' ) ) { get_template_part( 'template-parts/content', 'header' ); return; } ob_start(); wp_enqueue_style( 'alagu-custom-inline' ); if ( $custom_css = get_post_meta( $id, '_wpb_post_custom_css', true ) ) { wp_add_inline_style( 'alagu-custom-inline' , $custom_css ); } if ( $shortcode_custom_css = get_post_meta( $id, '_wpb_shortcodes_custom_css', true ) ) { wp_add_inline_style( 'alagu-custom-inline' , $shortcode_custom_css ); } echo '
'; echo do_shortcode( get_post_field( 'post_content', $id ) ); echo '
'; $content = ob_get_clean(); echo apply_filters( 'alagu_header_content', $content ); } } /* --------------------------------------------------------------------------- * Main Footer Hook * --------------------------------------------------------------------------- */ add_action( 'alagu_footer', 'alagu_vc_footer_template', 10 ); if( ! function_exists( 'alagu_vc_footer_template' ) ) { function alagu_vc_footer_template() { $id = ''; if( is_singular() ) { global $post; $settings = get_post_meta( $post->ID,'_dt_custom_settings',TRUE ); $settings = is_array( $settings ) ? $settings : array(); if( array_key_exists( 'show-footer', $settings ) && !$settings['show-footer'] ) return; $id = isset( $settings['footer'] ) ? $settings['footer'] : ''; $id = ( $id == '' ) ? alagu_get_option( 'site-custom-footer' ) : $id; } else if(function_exists( 'is_woocommerce' ) && is_shop()) { $shop_page_id = get_option('woocommerce_shop_page_id'); $settings = get_post_meta( $shop_page_id,'_dt_custom_settings',TRUE ); $settings = is_array( $settings ) ? $settings : array(); if( array_key_exists( 'show-footer', $settings ) && !$settings['show-footer'] ) return; $id = isset( $settings['footer'] ) ? $settings['footer'] : ''; $id = ( $id == '' ) ? alagu_get_option( 'site-custom-footer' ) : $id; } else { $id = alagu_get_option( 'site-custom-footer' ); } $id = apply_filters( 'alagu_footer_id', $id ); if( !$id || !function_exists( 'vc_lean_map' ) ) { $default_footer_option = alagu_get_option( 'default-footer-option', '' ); echo ''; return; } ob_start(); wp_enqueue_style( 'alagu-custom-inline' ); if ( $custom_css = get_post_meta( $id, '_wpb_post_custom_css', true ) ) { wp_add_inline_style( 'alagu-custom-inline' , $custom_css ); } if ( $shortcode_custom_css = get_post_meta( $id, '_wpb_shortcodes_custom_css', true ) ) { wp_add_inline_style( 'alagu-custom-inline' , $shortcode_custom_css ); } echo do_shortcode( get_post_field( 'post_content', $id ) ); $content = ob_get_clean(); echo apply_filters( 'alagu_footer_content', $content ); } } function footer_widetarea() { $sidebars = array('footer-column-1','footer-column-2','footer-column-3'); $active_sidebars = array(); $class = 'column dt-sc-one-column'; foreach( $sidebars as $sidebar ){ if( is_active_sidebar( $sidebar ) ) { array_push( $active_sidebars, $sidebar ); } } if( count( $active_sidebars) == 2 ) { $class = 'column dt-sc-one-half'; } elseif( count( $active_sidebars) == 3 ) { $class = 'column dt-sc-one-third'; } if( $active_sidebars ) { echo ''; } } /* --------------------------------------------------------------------------- * Hook of Bottom * --------------------------------------------------------------------------- */ function alagu_hook_bottom() { if( alagu_get_option( 'enable-bottom-hook' ) ) : echo ''; $hook = alagu_get_option( 'bottom-hook' ); if (!empty($hook)) echo do_shortcode( stripslashes($hook) ); echo ''; endif; } add_action( 'alagu_hook_bottom', 'alagu_hook_bottom' ); /* --------------------------------------------------------------------------- * Additional JS Hook * --------------------------------------------------------------------------- */ function alagu_hook_additional_js() { $hook = alagu_get_option( 'additional-js' ); if( $hook != '' ) : echo ''; echo ''; echo ''; endif; } add_action( 'wp_head', 'alagu_hook_additional_js' ); /* --------------------------------------------------------------------------- * Call Back For No Header Menu * --------------------------------------------------------------------------- */ function alagu_new_wp_page_menu() { $pages = wp_list_pages( array( 'depth' => 0, 'title_li' => '', 'echo' => 0, 'post_type' => 'page', 'link_before' => '', 'link_after' => '', 'post_status' => 'publish', 'walker' => new ALAGU_Walker_Page ) ); echo ''; } /* --------------------------------------------------------------------------- * Page Layout * --------------------------------------------------------------------------- */ function alagu_page_layout( $layout = '' ) { $page_layout = $sidebar_class = ''; $show_sidebar = $show_left_sidebar = $show_right_sidebar = false; $container_class = "container"; $image_size_class = ''; switch ( $layout ) { case 'with-left-sidebar': $page_layout = "page-with-sidebar with-left-sidebar"; $show_sidebar = $show_left_sidebar = true; $sidebar_class = "secondary-has-left-sidebar"; $image_size_class = 'default'; break; case 'with-right-sidebar': $page_layout = "page-with-sidebar with-right-sidebar"; $show_sidebar = $show_right_sidebar = true; $sidebar_class = "secondary-has-right-sidebar"; $image_size_class = 'default'; break; case 'with-both-sidebar': $page_layout = "page-with-sidebar with-both-sidebar"; $show_sidebar = $show_left_sidebar = $show_right_sidebar = true; $sidebar_class = "secondary-has-both-sidebar"; $image_size_class = 'default'; break; case 'fullwidth': $container_class = "portfolio-fullwidth-container"; $page_layout = "content-full-width"; $image_size_class = 'fullwidth'; break; case 'content-full-width': default: $page_layout = "content-full-width"; $image_size_class = 'default'; break; } if( ( is_archive() || is_search() || is_home() ) && $layout != 'content-full-width' ) { $left_std = alagu_get_option( 'show-standard-left-sidebar-for-post-archives' ); $right_std = alagu_get_option( 'show-standard-right-sidebar-for-post-archives' ); $left = $right = false; if( (isset($layout) && ($layout == 'with-left-sidebar' || $layout == 'with-both-sidebar')) && ( is_active_sidebar('post-archives-sidebar-left') || ( !empty( $left_std ) && is_active_sidebar('standard-sidebar-left') ) ) ) { $left = true; } if( (isset($layout) && ($layout == 'with-right-sidebar' || $layout == 'with-both-sidebar')) && ( is_active_sidebar('post-archives-sidebar-right') || ( !empty( $right_std ) && is_active_sidebar('standard-sidebar-right') ) ) ) { $right = true; } $pageid = get_option('page_for_posts'); if( $pageid > 0 ) { $settings = array(); $left = $right = false; $settings = get_post_meta($pageid,'_tpl_default_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); if( empty($settings) || ( array_key_exists( 'layout', $settings ) && $settings['layout'] == 'global-site-layout' ) ) { $settings['layout'] = alagu_get_option( 'site-global-sidebar-layout' ); $settings['show-standard-sidebar-left'] = true; $settings['show-standard-sidebar-right'] = true; unset($settings['widget-area-left']); unset($settings['widget-area-right']); } if( (isset($settings['layout']) && ($settings['layout'] == 'with-left-sidebar' || $settings['layout'] == 'with-both-sidebar')) && ( ( isset($settings['show-standard-sidebar-left']) && $settings['show-standard-sidebar-left'] && is_active_sidebar( 'standard-sidebar-left' ) ) || alagu_active_custom_widgetarea( 'page', $pageid, 'left' ) ) ) { $left = true; } if( (isset($settings['layout']) && ($settings['layout'] == 'with-right-sidebar' || $settings['layout'] == 'with-both-sidebar')) && ( ( isset($settings['show-standard-sidebar-right']) && $settings['show-standard-sidebar-right'] && is_active_sidebar( 'standard-sidebar-right' ) ) || alagu_active_custom_widgetarea( 'page', $pageid, 'right' ) ) ) { $right = true; } } if( $left && $right ) { $page_layout = "page-with-sidebar with-both-sidebar"; $show_sidebar = $show_left_sidebar = $show_right_sidebar = true; $sidebar_class = "secondary-has-both-sidebar"; $image_size_class = 'default'; } elseif( $left ) { $page_layout = "page-with-sidebar with-left-sidebar"; $sidebar_class = "secondary-has-left-sidebar"; $show_sidebar = $show_left_sidebar = true; $show_right_sidebar = false; } elseif( $right ) { $page_layout = "page-with-sidebar with-right-sidebar"; $sidebar_class = "secondary-has-right-sidebar"; $show_sidebar = $show_right_sidebar = true; $show_left_sidebar = false; } else { $page_layout = "content-full-width"; $show_sidebar = $show_left_sidebar = $show_right_sidebar = false; } } elseif( $layout != 'content-full-width' ) { global $post; $id = $post->ID; $type = $post->post_type; $settings = array(); if( $type == 'page' ){ $settings = get_post_meta($id,'_tpl_default_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); if( empty($settings) || ( array_key_exists( 'layout', $settings ) && $settings['layout'] == 'global-site-layout' ) ) { $settings['layout'] = alagu_get_option( 'site-global-sidebar-layout' ); $settings['show-standard-sidebar-left'] = true; $settings['show-standard-sidebar-right'] = true; unset($settings['widget-area-left']); unset($settings['widget-area-right']); } } elseif( $type == 'post' ){ $settings = get_post_meta($id,'_dt_post_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); if( empty($settings) || ( array_key_exists( 'layout', $settings ) && $settings['layout'] == 'global-site-layout' ) ) { $settings['layout'] = alagu_get_option( 'site-global-sidebar-layout' ); $settings['show-standard-sidebar-left'] = true; $settings['show-standard-sidebar-right'] = true; unset($settings['widget-area-left']); unset($settings['widget-area-right']); } } elseif( $type == 'dt_portfolios' ){ $settings = get_post_meta($id,'_portfolio_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); } elseif( $type == 'product' ){ $settings = get_post_meta($id,'_custom_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); if( empty($settings) || ( array_key_exists( 'page-layout', $settings ) && $settings['page-layout'] == 'admin-option' ) ) { $settings['layout'] = alagu_get_option( 'site-global-sidebar-layout' ); $settings['show-standard-sidebar-left'] = true; $settings['show-standard-sidebar-right'] = true; unset($settings['widget-area-left']); unset($settings['widget-area-right']); unset($settings['page-layout']); unset($settings['show-standard-sidebar']); unset($settings['product-widgetareas']); } } elseif( $type == 'tribe_events' ){ $settings = get_post_meta($id,'_custom_settings',TRUE); $settings = is_array( $settings ) ? array_filter( $settings ) : array(); if( empty($settings) || ( array_key_exists( 'layout', $settings ) && $settings['layout'] == 'global-site-layout' ) ) { $settings['layout'] = alagu_get_option( 'site-global-sidebar-layout' ); $settings['show-standard-sidebar-left'] = true; $settings['show-standard-sidebar-right'] = true; unset($settings['widget-area-left']); unset($settings['widget-area-right']); } } else { $settings = get_post_meta($id,'_custom_settings',TRUE); } $left = $right = false; if( (isset($settings['layout']) && ($settings['layout'] == 'with-left-sidebar' || $settings['layout'] == 'with-both-sidebar')) && ( ( isset($settings['show-standard-sidebar-left']) && $settings['show-standard-sidebar-left'] && is_active_sidebar( 'standard-sidebar-left' ) ) || alagu_active_custom_widgetarea( $type, $id, 'left' ) ) ) { $left = true; } if( (isset($settings['layout']) && ($settings['layout'] == 'with-right-sidebar' || $settings['layout'] == 'with-both-sidebar')) && ( ( isset($settings['show-standard-sidebar-right']) && $settings['show-standard-sidebar-right'] && is_active_sidebar( 'standard-sidebar-right' ) ) || alagu_active_custom_widgetarea( $type, $id, 'right' ) ) ) { $right = true; } if( (isset($settings['page-layout']) && ($settings['page-layout'] == 'with-left-sidebar')) && ( ( isset($settings['show-standard-sidebar']) && $settings['show-standard-sidebar'] && is_active_sidebar( 'standard-sidebar-left' ) ) || alagu_active_custom_widgetarea( $type, $id, 'left' ) ) && is_singular('product') ) { $left = true; } if( (isset($settings['page-layout']) && ($settings['page-layout'] == 'with-right-sidebar')) && ( ( isset($settings['show-standard-sidebar']) && $settings['show-standard-sidebar'] && is_active_sidebar( 'standard-sidebar-right' ) ) || alagu_active_custom_widgetarea( $type, $id, 'right' ) ) && is_singular('product') ) { $right = true; } if( $left && $right ) { $page_layout = "page-with-sidebar with-both-sidebar"; $show_sidebar = $show_left_sidebar = $show_right_sidebar = true; $sidebar_class = "secondary-has-both-sidebar"; $image_size_class = 'default'; } elseif( $left ) { $page_layout = "page-with-sidebar with-left-sidebar"; $sidebar_class = "secondary-has-left-sidebar"; $show_sidebar = $show_left_sidebar = true; $show_right_sidebar = false; } elseif( $right ) { $page_layout = "page-with-sidebar with-right-sidebar"; $sidebar_class = "secondary-has-right-sidebar"; $show_sidebar = $show_right_sidebar = true; $show_left_sidebar = false; } else { $page_layout = "content-full-width"; $show_sidebar = $show_left_sidebar = $show_right_sidebar = false; } } return array( 'page_layout' => $page_layout, 'sidebar_class' => $sidebar_class, 'show_sidebar' => $show_sidebar, 'show_left_sidebar' => $show_left_sidebar, 'show_right_sidebar' => $show_right_sidebar, 'container_class' => $container_class, 'image_size_class' => $image_size_class, ); } /* --------------------------------------------------------------------------- * Return Breadcrumb Style * --------------------------------------------------------------------------- */ function alagu_breadcrumb_css( $settings = array() ) { $bg = $co = $repeat = $pos = $attach = $size = $style = ''; $bg = !empty( $settings['image'] ) ? $settings['image'] : ''; $co = !empty( $settings['color'] ) ? $settings['color'] : ''; if(!empty($bg) || !empty($co)) : $repeat = !empty( $settings['repeat'] ) ? $settings['repeat'] :'repeat'; $pos = !empty( $settings['position'] ) ? $settings['position'] :'left top'; $attach = !empty( $settings['attachment'] ) ? $settings['attachment'] :'scroll'; $size = !empty( $settings['size'] ) ? $settings['size'] :'auto'; endif; $style = !empty($bg) ? "background-image: url($bg); " : ""; $style .= !empty($pos) ? "background-position: $pos; " : ""; $style .= !empty($size) ? "background-size: $size; " : ""; $style .= !empty($repeat) ? "background-repeat: $repeat; " : ""; $style .= !empty($attach) ? "background-attachment: $attach; " : ""; $style .= !empty($co) ? "background-color:$co;" : ""; return $style; } /* --------------------------------------------------------------------------- * Breadcrumb * --------------------------------------------------------------------------- */ function alagu_new_breadcrumbs( $args ) { $breadcrumbs = array(); $output = ''; $homeLink = esc_url( home_url('/') ); $separator = ''; $breadcrumbs[] = ''. esc_html__('Home','alagu') .''; $breadcrumbs = array_merge( $breadcrumbs, $args ); $output .= ''; return $output; } function alagu_breadcrumb_output( $title, $breadcrumbs, $class, $inline_css ) { $parallax = alagu_get_option( 'breadcrumb-parallax-bg' ); if( $parallax ) { $class .= ' dt-parallax-bg'; } $inline_css = !empty( $inline_css ) ? "style='".esc_attr($inline_css)."'" : ""; echo '
'; echo '
'; echo '
'; echo '
'. $title .'
'; echo alagu_new_breadcrumbs( $breadcrumbs ); echo '
'; echo '
'; }