/** * Get page layout * * @param string $default Default layout * * @return string */ function constructent_layout($default = 'sidebar-right') { // Default layout $layout = $default; // Site layout if ($site_layout = constructent_option('site_layout')) { $layout = $site_layout; } // Singular page can have custom layout if (is_page()) { $custom_layout = constructent_meta('layout'); if ($custom_layout && constructent_meta('custom_layout')) { $layout = $custom_layout; } else { $layout = constructent_option('page_layout'); } } // Shop page layout if (function_exists('is_woocommerce') && is_woocommerce()) { $layout = constructent_option('shop_layout'); } // Layout Full content if (is_page_template('tpl/portfolio.php') || is_singular('portfolio') || is_404()) { $layout = 'full-content'; } if (is_tax('portfolio_category') && constructent_option('portfolio_columns')) { $layout = 'full-content'; } // Allow to filter $layout = apply_filters(__FUNCTION__, $layout); return $layout; }
/** * Display header codes * * @return void * @since 1.0 */ function constructent_header_codes() { if (!function_exists('wp_site_icon')) { if ($favicon = constructent_option('favicon')) { echo '<link rel="shortcut icon" href="' . esc_url($favicon) . '">'; } if ($icon = constructent_option('touch_icon')) { echo '<link rel="apple-touch-icon-precomposed" href="' . esc_url($icon) . '">'; } } if ($scripts = constructent_option('header_scripts')) { echo $scripts; } }
?> </div> <?php } ?> </div> </div> </div> <?php } ?> <div id="footer-text" class="footer-text"> <div class="container"> <div class="row"> <?php $copyright = constructent_option('footer_copyright'); $copyright = wp_kses_post($copyright); ?> <div class="footer-copyright col-md-6 col-sm-12"> <div class="copyright"><?php echo do_shortcode($copyright); ?> </div> </div> <div class="footer-menu col-md-6 col-sm-12"> <?php if (has_nav_menu('footer')) { ?> <nav id="footer-nav" class="footer-nav nav clearfix"> <?php
/** * Show pie chart shortcode * * @param array $atts Shortcode attributes * @param string $content Shortcode content * * @return string */ function pie_chart($atts, $content = null) { extract(shortcode_atts(array('dimension' => '200', 'type' => 'full', 'color' => '', 'width' => '4', 'percent' => '100', 'font_size' => '24'), $atts)); $color = $color ? $color : constructent_option('color_scheme'); $colors = array('rosy' => '#f16c7c', 'pink' => '#ff0084', 'pink-dark' => '#e22092', 'red' => '#df4428', 'magenta' => '#a9014b', 'orange' => '#ff5c00', 'orange-dark' => '#dd4b39', 'yellow' => '#eeb313', 'green-light' => '#91bd09', 'green-lime' => '#32cd32', 'green' => '#238f23', 'blue' => '#00adee', 'blue-dark' => '#3b5998', 'indigo' => '#261e4c', 'violet' => '#9400d3', 'cappuccino' => '#af8e45', 'brown' => '#b77b48', 'brown-dark' => '#7a5230', 'gray' => '#dddddd', 'gray-dark' => '#666666', 'black' => '#333333', 'white' => '#ffffff'); $color = isset($colors[$color]) ? $colors[$color] : $color; return sprintf('<div class="fitsc-piechart"><div class="piechart" data-type="%s" data-percent="%s" data-dimension="%s" data-bgcolor="rgba(255,255,255,.05)" data-width="%s" data-fgcolor="%s" data-text="%s" data-fontsize="%d"><div class="piechart-info">%s</div></div></div>', esc_attr($type), esc_attr($percent), esc_attr($dimension), esc_attr($width), esc_attr($color), esc_attr($percent) . '%', absint($font_size), esc_attr($content)); }
/** * Get CSS for custom color scheme * * @return string */ function custom_color_scheme() { if (!constructent_option('custom_color_scheme')) { return ''; } $color_1 = constructent_option('custom_color_1'); $color_2 = constructent_option('custom_color_2'); if (empty($color_1)) { return ''; } // Getting credentials $url = wp_nonce_url('themes.php?page=theme-options'); if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) { return; } // Try to get the wp_filesystem running if (!WP_Filesystem($creds)) { // Ask the user for them again request_filesystem_credentials($url, '', true, false, null); return; } global $wp_filesystem; // Prepare LESS to compile $less = $wp_filesystem->get_contents(THEME_DIR . 'css/mixins.less'); $less .= ".custom-color-scheme { .color-scheme({$color_1}, {$color_2}); }"; // Compile require THEME_DIR . 'lib/lessc.inc.php'; $compiler = new lessc(); $compiler->setFormatter('compressed'); return $compiler->compile($less); }
<span class="mini-cart-counter"><?php echo $woocommerce->cart->cart_contents_count; ?> </span> </a> <div id="mini-cart-content" class="mini-cart-content widget_shopping_cart_content"><?php woocommerce_mini_cart(); ?> </div> </div> <?php } ?> <?php if (constructent_option('header_search')) { ?> <div class="search-wrapper right"> <a href="#" class="search-icon pe-7s-search"></a> </div> <?php } ?> </div><!-- .header-right --> <nav id="site-nav" class="site-nav navbar col-xs-3 col-sm-9 col-md-8 right"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#primary-nav"> <span class="sr-only"><?php esc_html_e('Toggle Navigation', 'constructent'); ?>
<?php if (is_front_page()) { return; } if (constructent_option('hide_breadcrumbs')) { return; } if (is_page() && constructent_meta('hide_breadcrumbs')) { return; } $tax = 'category'; if (function_exists('is_woocommerce') && is_woocommerce()) { $tax = 'product_cat'; } elseif (is_singular('portfolio') || is_tax('portfolio_category')) { $tax = 'portfolio_category'; } echo '<div class="breadcrumb-wrapper container"><ul class="breadcrumb">'; constructent_breadcrumbs(array('separator' => '', 'before' => '', 'before_item' => '<li>', 'after_item' => '</li>', 'display_last_item' => true, 'taxonomy' => $tax)); echo '</ul></div>';
/** * Add custom script to footer * * @since 1.0 * @return void */ function counstructent_footer_scripts() { if ($scripts = constructent_option('footer_scripts')) { echo $scripts; } }
/** * Add classes to <body> * * @param array $classes * * @return array */ function constructent_body_class($classes) { // Layout class $classes[] = constructent_layout(); // Class for layout style $classes[] = constructent_option('layout_style'); // Color scheme $custom_color_scheme = constructent_option('custom_color_scheme'); if (!$custom_color_scheme) { $classes[] = constructent_option('color_scheme'); } else { $classes[] = 'custom-color-scheme'; } // Class for custom header color if (constructent_option('header_custom') && constructent_option('header_background')) { $classes[] = 'header-custom'; } // Class for woocommerce columns if (function_exists('is_shop') && (is_shop() || is_product_taxonomy())) { global $woocommerce_loop; if (empty($woocommerce_loop['columns'])) { $columns = 'full-content' == constructent_layout() ? 4 : 3; } else { $columns = $woocommerce_loop['columns']; } $classes[] = 'columns-' . esc_attr($columns); } // Class for solid header $header_type = constructent_option('header_type'); $header_type = $header_type ? esc_attr($header_type) : 'static'; if ($header_type == 'absolute' && !is_page_template('tpl/homepage.php')) { $classes[] = 'header-static'; } else { $classes[] = 'header-' . $header_type; } // Transparent header if ('absolute' == $header_type && is_page_template('tpl/homepage.php') && constructent_option('header_transparent')) { $classes[] = 'header-transparent'; } // Class for menu hover if ($hover = constructent_option('menu_hover')) { $classes[] = 'menu-hover-' . $hover; } // If no featured title area if (!constructent_show_featured_title()) { $classes[] = 'no-title-area'; } // Class for portfolio layout if (is_page_template('tpl/portfolio.php')) { $classes[] = 'portfolio-' . constructent_meta('style_portfolio'); } // Class for portfolio category layout if (is_tax('portfolio_category')) { $classes[] = 'portfolio-' . constructent_option('portfolio_view'); } $classes = array_unique(array_filter($classes)); return $classes; }
/** * Display entry content or summary * * @return void */ function constructent_entry_content() { if (is_singular()) { echo '<div class="entry-content">'; the_content(); constructent_entry_meta(); if (is_single()) { the_post_navigation($args = array('prev_text' => esc_html__('Previous Post', 'constructent'), 'next_text' => esc_html__('Next Post', 'constructent'))); } echo '</div>'; return; } // Display type $display = constructent_option('blog_display'); // Allow to config via global variable if (!$display) { $display = 'content'; } echo '<div class="entry-summary">'; // Excerpt if ('excerpt' == $display) { the_excerpt(); return; } // Check is post format audio if (!has_post_format('audio')) { $more_text = constructent_more_text(); } else { $more_text = ''; } // Post content before more tag if ('more' == $display) { if (is_page_template('tpl/blog.php')) { global $more; $more = false; } the_content($more_text); wp_link_pages(array('before' => '<p class="pages">' . esc_html__('Pages:', 'constructent'), 'after' => '</p>', 'link_before' => '<span>', 'link_after' => '</span>')); } else { $content = constructent_content_limit(constructent_content_length(), $more_text, false); echo constructent_post_formats_content($content); } echo '</div>'; // .entry-summary }
</header> <?php } ?> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages(array('before' => '<p class="pages">' . esc_html__('Pages:', 'constructent'), 'after' => '</p>', 'link_before' => '<span>', 'link_after' => '</span>')); ?> </div> </article> <?php if (constructent_option('page_comment')) { comments_template('', true); } ?> <?php } else { ?> <?php get_template_part('tpl/parts/content', 'none'); ?> <?php }