function layers_print_typekit() { if ('' == layers_get_theme_mod('typekit-id')) { return; } ?> <script type="text/javascript" src="//use.typekit.net/<?php echo esc_js(layers_get_theme_mod('typekit-id')); ?> .js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script> <?php }
function layers_generate_customizer_fonts() { global $layers_custom_fonts; // Apply Font Styles $customizer_options = new Layers_Customizer_Config(); foreach ($customizer_options->controls() as $controls) { foreach ($controls as $control_key => $control_data) { if ('layers-font' == $control_data['type'] && layers_get_theme_mod($control_key)) { // Add fonts to a bucket for registration $layers_custom_fonts[] = layers_get_theme_mod($control_key); layers_inline_styles($control_data['selectors'], 'font-family', array('font-family' => layers_get_theme_mod($control_key))); } } } }
/** * Get Layers Setup Options */ public function site_setup_actions() { $site_setup_actions['google-analytics'] = array('label' => __('Google Analytics', 'layerswp'), 'excerpt' => __('Enter in your Google Analytics ID to enable website traffic reporting.', 'layerswp'), 'form' => array('layers-header-google-id' => array('type' => 'text', 'name' => 'layers-header-google-id', 'id' => 'layers-header-google-id', 'placeholder' => __('UA-xxxxxx-xx', 'layerswp'), 'value' => layers_get_theme_mod('header-google-id'))), 'skip-action' => 'layers_site_setup_step_dismissal', 'submit-action' => 'layers_onboarding_set_theme_mods', 'submit-text' => __('Save', 'layerswp')); $site_setup_actions['copyright'] = array('label' => __('Copyright Text', 'layerswp'), 'form' => array('layers-footer-copyright-text' => array('type' => 'text', 'name' => 'layers-footer-copyright-text', 'id' => 'layers-footer-copyright-text', 'placeholder' => __('Made at the tip of Africa. ©', 'layerswp'), 'value' => layers_get_theme_mod('footer-copyright-text'))), 'skip-action' => 'layers_site_setup_step_dismissal', 'submit-action' => 'layers_onboarding_set_theme_mods', 'submit-text' => __('Save', 'layerswp')); if (0 == count(get_posts('post_type=nav_menu_item'))) { $site_setup_actions['menus'] = array('label' => __('Setup your website menu', 'layerswp'), 'excerpt' => __(sprintf('Navigation is a key element of setting up your website. Controly our menus here. For more information read our <a href="%s" target="_blank">help guide</a>.', 'http://docs.layerswp.com/doc/create-your-menus/'), 'layerswp'), 'form' => array('layers-menu-link' => array('type' => 'button', 'name' => 'layers-menu-link', 'id' => 'layers-menu-link', 'href' => admin_url('nav-menus.php'), 'target' => '_blank', 'tag' => 'a', 'class' => 'layers-button btn-primary', 'label' => __('Setup Menus', 'layerswp'))), 'skip-action' => 'layers_site_setup_step_dismissal'); } return apply_filters('layers_setup_actions', $site_setup_actions); }
function intercom_js() { global $current_user, $wpdb, $wp_version, $wp_customize; // Don't load in the customizer, or if we're not logged in; don't even try it. if (!is_user_logged_in() || !is_admin() || !current_user_can('administrator')) { return; } // Get current user info $current_user = wp_get_current_user(); /** * Basic Intercom settings */ $json['app_id'] = $this->app_id; $json['user_hash'] = (string) hash_hmac('sha256', $current_user->user_email, $this->secret_key); /** * User centric data */ $json['email'] = (string) $current_user->user_email; $json['name'] = (string) $current_user->display_name; $json['created_at'] = strtotime($current_user->user_registered); $json['company'] = strtotime(get_bloginfo('name')); /** * Child theme information */ $this->theme = wp_get_theme(); if ('layerswp' != $this->theme->get('TextDomain')) { $json['Theme'] = (string) $this->theme->get('Name'); $json['Theme Author'] = (string) $this->theme->get('Author'); $json['Theme Author URL'] = (string) $this->theme->get('AuthorURI'); } /** * Layers specific data */ $this->layers_theme = wp_get_theme('layerswp'); $json['WordPress Version'] = $wp_version; $json['Layers Version'] = $this->layers_theme->get('Version'); $json['Layers Page Count'] = (double) count(layers_get_builder_pages()); /** * Website URL */ $json['Website URL'] = (string) get_home_url(); /** * Important plugins */ $json['Easy Digital Downloads'] = (bool) (class_exists('Easy_Digital_Downloads') ? 1 : 0); $json['WooCommerce'] = (bool) (class_exists('WooCommerce') ? 1 : 0); $json['Layers Updater'] = (bool) (class_exists('Layers_Updater') || is_plugin_active_for_network('Layers_Updater') ? 1 : 0); if (class_exists('Layers_DevKit') && defined('LAYERS_DEVKIT_VER')) { $json['DevKit'] = LAYERS_DEVKIT_VER; } if (class_exists('Layers_ColorKit') && defined('LAYERS_COLORKIT_VER')) { $json['ColorKit'] = LAYERS_COLORKIT_VER; } if (class_exists('Layers_WooCommerce') && defined('LAYERS_STOREKIT_VER')) { $json['StoreKit'] = LAYERS_STOREKIT_VER; } if (class_exists('Layers_Showcase') && defined('LAYERS_SHOWCASE_VER')) { $json['Showcase'] = LAYERS_SHOWCASE_VER; } if (class_exists('Layers_Pro') && defined('LAYERS_PRO_VER')) { $json['Layers Pro'] = LAYERS_PRO_VER; } if (get_option('info_site_usage')) { $json['Site Category'] = get_option('info_site_usage'); } $json['Skill Level'] = get_option('layers_info_developer'); $json['Launchpad'] = class_exists('apollo_launchpad') ? 1 : 0; $launchpad = get_option('apollo_display_options'); if (isset($launchpad['launchdate'])) { $json['launched_at'] = strtotime($launchpad['launchdate']); } $json['Custom CSS'] = (bool) layers_get_theme_mod('custom-css'); // jsonify the settings $settings_json = json_encode((object) $json, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : TRUE); ?> <script>window.intercomSettings = <?php echo $settings_json; ?> ;</script> <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/<?php echo $this->app_id; ?> ';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script> <?php }
function layers_apply_custom_styles() { wp_enqueue_style(LAYERS_THEME_SLUG . '-custom-styles', get_template_directory_uri() . '/assets/css/custom.css'); wp_add_inline_style(LAYERS_THEME_SLUG . '-custom-styles', layers_get_theme_mod('custom-css')); }
<header <?php layers_header_class(); ?> > <?php do_action('layers_before_header_inner'); ?> <div class="<?php if ('layout-fullwidth' != layers_get_theme_mod('header-width')) { echo 'container'; } ?> clearfix"> <?php if ('header-logo-center' == layers_get_theme_mod('header-menu-layout')) { ?> <?php get_template_part('partials/header', 'centered'); ?> <?php } else { ?> <?php get_template_part('partials/header', 'standard'); ?> <?php } // if centered header ?> </div>
function layers_add_google_analytics() { $analytics_id = layers_get_theme_mod('header-google-id'); if ('' != $analytics_id) { ?> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php echo $analytics_id; ?> ', 'auto'); ga('send', 'pageview'); </script> <?php } }
/** * Widget name generation (replaces get_custom_field_id) * * @param string $field_name_1 Level 1 name * @param string $field_name_2 Level 2 name * @param string $field_name_3 Level 3 name * @return string Name attribute */ function get_layers_field_name($field_name_1 = '', $field_name_2 = '', $field_name_3 = '') { // If we don't have these important widget details then bail. if (!isset($this->widget['name'])) { return; } // Compile the first part. $string = $this->widget['name']; // Now add any custom strings passed as args. if ('' != $field_name_1) { $string .= '[' . $field_name_1 . ']'; } if ('' != $field_name_2) { $string .= '[' . $field_name_2 . ']'; } if ('' != $field_name_3) { $string .= '[' . $field_name_3 . ']'; } if ((bool) layers_get_theme_mod('dev-switch-widget-field-names')) { $debug_string = substr($string, strpos($string, ']') + 1, strlen($string)); echo '<span class="layers-widget-defaults-debug">' . $debug_string . '</span><br />'; } return $string; }
global $product; $_product = $product; ?> <div <?php layers_center_column_class(); ?> > <div class="product-top clearfix"> <?php do_action('woocommerce_before_single_product', $post, $_product); ?> <div class="row"> <!-- Show the Images --> <div class="column product-images span-6 <?php echo 'advanced-layout-right' == layers_get_theme_mod('woocommerce-product-page-layout') ? 'pull-right no-gutter' : ''; ?> "> <?php do_action('woocommerce_before_single_product_summary', $post, $_product); ?> </div> <!-- Show the Product Summary --> <div class="column purchase-options-container span-6"> <?php do_action('woocommerce_single_product_summary', $post, $_product); ?> </div> </div> </div>
function layers_scripts() { /** * Front end Scripts */ wp_enqueue_script(LAYERS_THEME_SLUG . '-plugins', get_template_directory_uri() . '/assets/js/plugins.js', array('jquery'), LAYERS_VERSION); // Sticky-Kit wp_enqueue_script(LAYERS_THEME_SLUG . '-framework', get_template_directory_uri() . '/assets/js/layers.framework.js', array('jquery'), LAYERS_VERSION); // Framework wp_localize_script(LAYERS_THEME_SLUG . '-framework', 'layers_script_settings', array('header_sticky_breakpoint' => apply_filters('layers_sticky_header_breakpoint', 270))); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } // Comment reply script // Google Maps wp_register_script(LAYERS_THEME_SLUG . '-map-api', '//maps.googleapis.com/maps/api/js?key=' . layers_get_theme_mod('google-maps-api')); wp_register_script(LAYERS_THEME_SLUG . '-map-trigger', get_template_directory_uri() . '/core/widgets/js/maps.js', array('jquery'), LAYERS_VERSION); /** * Front end Styles */ wp_enqueue_style(LAYERS_THEME_SLUG . '-framework', get_template_directory_uri() . '/assets/css/framework.css', array(), LAYERS_VERSION); wp_enqueue_style(LAYERS_THEME_SLUG . '-components', get_template_directory_uri() . '/assets/css/components.css', array(), LAYERS_VERSION); // Compontents wp_enqueue_style(LAYERS_THEME_SLUG . '-responsive', get_template_directory_uri() . '/assets/css/responsive.css', array(), LAYERS_VERSION); // Responsive wp_enqueue_style(LAYERS_THEME_SLUG . '-icon-fonts', get_template_directory_uri() . '/assets/css/layers-icons.css', array(), LAYERS_VERSION); // Icon Font if (class_exists('WooCommerce')) { wp_enqueue_style(LAYERS_THEME_SLUG . '-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css', array(), LAYERS_VERSION); // Woocommerce } if (is_admin_bar_showing()) { wp_enqueue_style(LAYERS_THEME_SLUG . '-admin', get_template_directory_uri() . '/core/assets/icons.css', array(), LAYERS_VERSION); // Admin CSS } wp_register_style(LAYERS_THEME_SLUG . '-font-awesome', get_template_directory_uri() . '/core/assets/plugins/font-awesome/font-awesome.min.css', array(), LAYERS_VERSION); // Font Awesome // Swiper Slider wp_register_script(LAYERS_THEME_SLUG . '-slider-js', get_template_directory_uri() . '/core/widgets/js/swiper.js', array('jquery'), LAYERS_VERSION); wp_register_style(LAYERS_THEME_SLUG . '-slider', get_template_directory_uri() . '/core/widgets/css/swiper.css', array(), LAYERS_VERSION); // Layers Masonry. wp_register_script(LAYERS_THEME_SLUG . '-layers-masonry-js', get_template_directory_uri() . '/assets/js/layers.masonry.js', array('jquery', 'masonry'), LAYERS_VERSION); }
<div class="column span-6 clearfix t-right"> <?php wp_nav_menu(array('theme_location' => LAYERS_THEME_SLUG . '-footer', 'container' => 'nav', 'container_class' => 'nav nav-horizontal pull-right', 'fallback_cb' => false)); ?> </div> </div> <?php do_action('layers_after_footer_copyright'); ?> </div> <?php do_action('layers_after_footer_inner'); ?> <?php if (false != layers_get_theme_mod('show-layers-badge')) { ?> <?php _e(sprintf('<a class="created-using-layers" target="_blank" tooltip="Built with Layers" href="%s"><span>Built with Layers</span></a>', 'http://www.layerswp.com'), 'layerswp'); ?> <?php } ?> </footer><!-- END / FOOTER --> <?php do_action('layers_after_footer'); ?> </section><!-- END / MAIN SITE #wrapper --> <?php do_action('layers_after_site_wrapper');
function layers_woocommerce_can_show_sidebar($can_show_sidebar, $sidebar) { if (is_post_type_archive('product')) { $can_show_sidebar = layers_get_theme_mod('archive-' . $sidebar); } elseif (is_singular('product')) { $can_show_sidebar = layers_get_theme_mod('single-' . $sidebar); } return $can_show_sidebar; }
function layers_child_customizer_styles() { /** * Setup the colors to use below */ $widget_title_color = layers_get_theme_mod('widget-title-color', TRUE); if ('' != $widget_title_color) { // Content - Links layers_inline_styles(array('selectors' => array('.sidebar .section-nav-title'), 'css' => array('color' => $widget_title_color))); } }
?> <?php } // if 0 != sidebars ?> <?php do_action('layers_before_footer_copyright'); ?> <div class="row copyright"> <?php if ('' != layers_get_theme_mod('footer-copyright-text')) { ?> <div class="column span-6"> <p class="site-text"><?php echo esc_html(layers_get_theme_mod('footer-copyright-text')); ?> </p> </div> <?php } ?> <div class="column span-6 clearfix t-right"> <?php wp_nav_menu(array('theme_location' => LAYERS_THEME_SLUG . '-footer', 'container' => 'nav', 'container_class' => 'nav nav-horizontal pull-right', 'fallback_cb' => false)); ?> </div> </div> <?php do_action('layers_after_footer_copyright'); ?>
/** * The template for displaying Woo Commerce products * * @package Layers * @since Layers 1.0.0 * @version 1.6.4 */ get_header(); ?> <?php get_template_part('partials/header', 'page-title'); ?> <section class="<?php if ('layout-fullwidth' != layers_get_theme_mod('content-layout-layout')) { echo 'container'; } ?> clearfix content-main row"> <?php /** * Maybe show the left sidebar */ layers_maybe_get_sidebar('left-woocommerce-sidebar', implode(' ', layers_get_wrapper_class('left_woocommerce_sidebar', 'column pull-left sidebar span-3'))); ?> <?php if (have_posts()) { ?>
/** * Widget name generation (replaces get_custom_field_id) * * @param string $field_name_1 Level 1 name * @param string $field_name_2 Level 2 name * @param string $field_name_3 Level 3 name * @param string $field_name_4 Level 4 name * @return string Name attribute */ function get_layers_field_name($field_name_1 = '', $field_name_2 = '', $field_name_3 = '', $field_name_4 = '') { // If we don't have these important widget details then bail. if (!isset($this->id_base) || !isset($this->number)) { return; } // Compile the first part. $string = 'widget-' . $this->id_base . '[' . $this->number . ']'; // If this is called in e.g. a button_item then by setting $field_attribute_prefixes args array, // before it's called the prefixes will be added at this point in the string construction. if (isset($this->field_attribute_prefixes) && !empty($this->field_attribute_prefixes)) { $string .= '[' . implode('][', $this->field_attribute_prefixes) . ']'; } // Now add any custom strings passed as args. if ('' != $field_name_1) { $string .= '[' . $field_name_1 . ']'; } if ('' != $field_name_2) { $string .= '[' . $field_name_2 . ']'; } if ('' != $field_name_3) { $string .= '[' . $field_name_3 . ']'; } if ('' != $field_name_4) { $string .= '[' . $field_name_4 . ']'; } if ((bool) layers_get_theme_mod('dev-switch-widget-field-names')) { $debug_replace = 'widget-' . $this->id_base . '[' . $this->number . ']'; $debug_string = str_replace($debug_replace, '', $string); echo '<span class="layers-widget-defaults-debug">' . $debug_string . '</span><br />'; } return $string; }
<?php if (has_nav_menu(LAYERS_THEME_SLUG . '-secondary-left') || has_nav_menu(LAYERS_THEME_SLUG . '-secondary-right')) { ?> <div class="header-secondary content-small invert"> <?php do_action('layers_before_header_secondary_inner'); ?> <div class="<?php if ('layout-fullwidth' != layers_get_theme_mod('header-width')) { echo 'container'; } ?> clearfix"> <?php do_action('layers_before_header_secondary_left_nav'); ?> <?php wp_nav_menu(array('theme_location' => LAYERS_THEME_SLUG . '-secondary-left', 'container' => 'nav', 'container_class' => 'pull-left', 'menu_class' => 'nav nav-horizontal', 'fallback_cb' => 'layers_menu_fallback')); ?> <?php do_action('layers_after_header_secondary_left_nav'); ?> <?php do_action('layers_before_header_secondary_right_nav'); ?> <?php wp_nav_menu(array('theme_location' => LAYERS_THEME_SLUG . '-secondary-right', 'container' => 'nav', 'container_class' => 'pull-right', 'menu_class' => 'nav nav-horizontal', 'fallback_cb' => false)); ?> <?php
echo $form_elements->input(array('type' => 'select', 'name' => 'layers_info_developer', 'id' => 'layers_info_developer', 'value' => get_option('layers_info_developer'), 'options' => array('beginner' => __('I\'m not a designer / developer. I just need a website for myself.', 'layerswp'), 'learning' => __('I am learning to become a designer / developer.', 'layerswp'), 'wordpress_developer' => __('I am a theme / plugin developer.', 'layerswp'), 'freelance' => __('I am a freelance designer / developer.', 'layerswp'), 'agency' => __('I am a designer / developer at an agency or organization.', 'layerswp')), 'class' => 'l_admin-large')); ?> </div> <div class="l_admin-form-item"> <label> <?php _e('Choose a primary color?', 'layerswp'); ?> <i class="fa fa-question-circle" data-tip="<?php _e('We\'ll use this color in select places around your website.', 'layerswp'); ?> "></i> </label> <?php echo $form_elements->input(array('type' => 'color', 'name' => 'site_color', 'id' => 'site_color', 'value' => layers_get_theme_mod('header-background-color') ? layers_get_theme_mod('header-background-color') : '#009eec')); ?> </div> <?php echo $form_elements->input(array('type' => 'hidden', 'name' => 'action', 'id' => 'action', 'value' => 'layers_onboarding_update_options')); ?> </div> <div class="l_admin-button-well"> <span class="l_admin-save-progress l_admin-hide l_admin-button btn-link" data-busy-message="<?php _e('Saving your Site Name', 'layerswp'); ?> "></span>
<?php if ('header-sidebar' == layers_get_theme_mod('header-menu-layout')) { ?> <?php get_template_part('partials/footer', 'standard'); ?> <?php } ?> </section> <?php if ('header-sidebar' == layers_get_theme_mod('header-menu-layout')) { ?> </div><!-- /header side wrapper --> <?php } else { get_template_part('partials/footer', 'standard'); } ?> </div><!-- END / MAIN SITE #wrapper --> <?php do_action('layers_after_site_wrapper'); ?> <?php wp_footer(); ?>