<?php /** * Header section of our theme * * Displays all of the <div id="header"> section * * @package WordPress * @subpackage Kleo * @since Kleo 1.0 */ //set logo path $logo_path = sq_option_url('logo'); $logo_path = apply_filters('kleo_logo', $logo_path); $social_icons = apply_filters('kleo_show_social_icons', sq_option('show_social_icons', 1)); $top_bar = sq_option('show_top_bar', 1); $top_bar = apply_filters('kleo_show_top_bar', $top_bar); $top_menu = wp_nav_menu(array('theme_location' => 'top', 'depth' => 2, 'container' => 'div', 'container_class' => 'top-menu col-sm-12 col-md-7 no-padd', 'menu_class' => '', 'fallback_cb' => '', 'walker' => new kleo_walker_nav_menu(), 'echo' => false)); $primary_menu = wp_nav_menu(array('theme_location' => 'primary', 'depth' => 3, 'container' => 'div', 'container_class' => 'collapse navbar-collapse nav-collapse', 'menu_class' => 'nav navbar-nav', 'fallback_cb' => '', 'walker' => new kleo_walker_nav_menu(), 'echo' => false)); ?> <div id="header" class="header-color"> <div class="navbar" role="navigation"> <?php if ($top_bar == 1) { //top bar enabled ?> <!--Attributes-->
function kleo_maintenance_mode() { $logo_path = apply_filters('kleo_logo', sq_option_url('logo')); $logo_img = '<img src="' . $logo_path . '" alt="maintenance" style="margin: 0 auto; display: block;" />'; if (sq_option('maintenance_mode', 0) == 1) { /* Theme My Login compatibility */ if (class_exists('Theme_My_Login') && Theme_My_Login::is_tml_page('login')) { return; } if (!current_user_can('edit_themes') || !is_user_logged_in()) { wp_die($logo_img . '<div style="text-align:center">' . sq_option('maintenance_msg', '') . '</div>', get_bloginfo('name')); } } }
function custom_login_css() { global $kleo_theme; echo "\n<style>"; echo $kleo_theme->get_bg_css('header_background', 'body.login'); echo '.login h1 a { background-image: url("' . sq_option_url('logo', 'none') . '");background-size: contain;min-height: 88px;width:auto;}'; echo '#login {padding: 20px 0 0;}'; echo '.login #nav a, .login #backtoblog a {color:' . sq_option('header_primary_color') . '!important;text-shadow:none;}'; echo "</style>\n"; }
function kleo_get_social_profiles($args = false) { $output = ''; $icons = ''; $all_options = get_option("kleo_" . KLEO_DOMAIN); $defaults = array('container' => 'ul', 'item_tag' => 'li', 'target' => '_blank'); // Parse incomming $args into an array and merge it with $defaults $args = wp_parse_args($args, $defaults); $args = apply_filters('kleo_get_social_profiles_args', $args); //get social data from theme options if (!empty($all_options)) { foreach ($all_options as $k => $opt) { if (substr($k, 0, 7) === 'social_' && !empty($opt)) { $k = str_replace('social_', '', $k); $title = str_replace(array('gplus', 'vimeo-squared', 'pinterest-circled', 'instagramm'), array('Google+', 'Vimeo', 'Pinterest', 'Instagram'), $k); $icons .= '<' . $args['item_tag'] . '>'; if ($k == 'twitter') { $icons .= '<a id="weixin" target="' . $args['target'] . '" href="' . $opt['url'] . '"><img src="' . get_template_directory_uri() . '/assets/img/weixin.png"></a>'; } elseif ($k == 'facebook') { $icons .= '<a target="' . $args['target'] . '" href="' . $opt . '"><img src="' . get_template_directory_uri() . '/assets/img/txwb.png"></a>'; } elseif ($k == 'dribbble') { $icons .= '<a target="' . $args['target'] . '" href="' . $opt . '"><img src="' . get_template_directory_uri() . '/assets/img/xlwb.png"></a>'; } // <div class="ts-text">'.ucfirst($title).'</div> title $icons .= '</' . $args['item_tag'] . '>'; } } } $icons = apply_filters('kleo_get_social_profiles', $icons); if ($icons != '') { $output .= '<' . $args['container'] . '>'; if (apply_filters('kleo_logo', sq_option_url('social_twitter'))) { $output .= '<map id="show-weixin"><img src="' . apply_filters('kleo_logo', sq_option_url('social_twitter')) . '"></map>'; } $output .= $icons; $output .= '</' . $args['container'] . '>'; } return $output; }
/** * Get the Featured image URL of a post * @global object $post * @param string $size * @return string */ function kleo_get_post_thumbnail_url() { $image_url = ''; if ($thumb = get_post_thumbnail_id()) { $image_url = wp_get_attachment_url($thumb); } elseif (sq_option('blog_get_image', 1) == 1) { global $post; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $image_url = isset($matches[1][0]) ? $matches[1][0] : null; } //Defines a default image if (empty($image_url)) { $image_url = sq_option_url('blog_default_image', ''); } return $image_url; }
<?php if (sq_option_url('apple114')) { ?> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo sq_option_url('apple114'); ?> "> <?php } ?> <?php if (sq_option_url('apple144')) { ?> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo sq_option_url('apple144'); ?> "> <?php } ?> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?> /assets/js/html5shiv.js"></script> <![endif]--> <!--[if IE 7]>
/** * Get the Featured image URL of a post * @global object $post * @param int $post_id * @return string */ function kleo_get_post_thumbnail_url($post_id = null) { $image_url = ''; $thumb = get_post_thumbnail_id($post_id); //all good. we have a featured image $featured_image_url = wp_get_attachment_url($thumb); if ($featured_image_url) { $image_url = $featured_image_url; } elseif (sq_option('blog_get_image', 1) == 1) { global $post; if (!is_object($post) && $post_id != NULL) { $post = setup_postdata(get_post($post_id)); } ob_start(); ob_end_clean(); if (isset($post->post_content)) { $output = preg_match_all('|<img.*?src=[\'"](.*?)[\'"].*?>|i', $post->post_content, $matches); $image_url = isset($matches[1][0]) ? $matches[1][0] : null; } } //Defines a default image if (empty($image_url)) { $image_url = sq_option_url('blog_default_image', ''); } return $image_url; }