/** * Adds custom classes to the array of body classes. * * @since 1.0 * @param array $classes Classes for the body element. * @return array */ function onehost_body_classes($classes) { // Adds a class of group-blog to blogs with more than 1 published author. if (is_multi_author()) { $classes[] = 'group-blog'; } // Add a class of layout $classes[] = onehost_get_layout(); // Add a class when choose no animation if (onehost_theme_option('no_animation')) { $classes[] = 'no-animation'; } // Add a class when choose no animation $classes[] = onehost_theme_option('site_style') . '-version'; // Add a class for color scheme if (onehost_theme_option('custom_color_scheme') && onehost_theme_option('custom_color_1')) { $classes[] = 'custom-color-scheme'; } else { $classes[] = onehost_theme_option('color_scheme'); } if (onehost_get_meta('hide_singular_title')) { $classes[] = 'hide-singular-title'; } return $classes; }
/** * Get layout base on current page * * @return string */ function onehost_get_layout() { $layout = onehost_theme_option('default_layout'); $custom_layout = onehost_get_meta('layout'); if (is_page()) { if (onehost_get_meta('custom_layout') && $custom_layout) { $layout = $custom_layout; } else { $layout = onehost_theme_option('page_layout'); } } elseif (is_singular('post')) { if (onehost_get_meta('custom_layout') && $custom_layout) { $layout = $custom_layout; } else { $layout = onehost_theme_option('single_layout'); } } elseif (is_404()) { $layout = 'full-content'; } return $layout; }
?> "> <main id="main" class="site-main" role="main"> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('parts/content', 'page'); ?> <?php // If comments are open or we have at least one comment, load up the comment template if (onehost_theme_option('page_comments')) { comments_template(); } ?> <?php } // end of the loop. ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();
/** * Custom scripts and styles on header * * @since 1.0 */ function onehost_header_scripts() { $inline_css = ''; // Logo $logo_size_width = intval(onehost_theme_option('logo_size_width')); $logo_css = $logo_size_width ? 'width:' . $logo_size_width . 'px; ' : ''; $logo_size_height = intval(onehost_theme_option('logo_size_height')); $logo_css .= $logo_size_height ? 'height:' . $logo_size_height . 'px; ' : ''; $logo_margin_top = intval(onehost_theme_option('logo_margin_top')); $logo_css .= $logo_margin_top ? 'margin-top:' . $logo_margin_top . 'px;' : ''; $logo_margin_right = intval(onehost_theme_option('logo_margin_right')); $logo_css .= $logo_margin_right ? 'margin-right:' . $logo_margin_right . 'px;' : ''; $logo_margin_bottom = intval(onehost_theme_option('logo_margin_bottom')); $logo_css .= $logo_margin_bottom ? 'margin-bottom:' . $logo_margin_bottom . 'px;' : ''; $logo_margin_left = intval(onehost_theme_option('logo_margin_left')); $logo_css .= $logo_margin_left ? 'margin-left:' . $logo_margin_bottom . 'px;' : ''; if (!empty($logo_css)) { $inline_css .= '#site-header .site-branding .site-logo img ' . ' {' . $logo_css . '}'; } // Featured Title Area $image = onehost_get_meta('singular_title_area_bg'); if ($image) { $image = wp_get_attachment_image_src($image, 'full'); $image = $image ? $image[0] : ''; } if (!$image) { $image = onehost_theme_option('title_area_bg'); } $featured_css = $image ? "background-image: url({$image})" : ''; if (!empty($featured_css)) { $inline_css .= '#title-area {' . $featured_css . '}'; } // Custom CSS $css_custom = onehost_get_meta('custom_css') . onehost_theme_option('custom_css'); if (!empty($css_custom)) { $inline_css .= $css_custom; } if (!empty($inline_css)) { $inline_css = '<style type="text/css">' . $inline_css . '</style>'; } // Custom javascript $js_custom = onehost_get_meta('custom_js') . onehost_theme_option('header_scripts'); if (!empty($js_custom)) { $js_custom = '<script type="text/javascript">' . $js_custom . '</script>'; } $inline_css .= $inline_css . $js_custom; if ($inline_css) { echo $inline_css; } }
?> <div id="primary" class="content-area col-sm-12 col-md-12"> <main id="main" class="site-main" role="main"> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('parts/content', 'portfolio'); ?> <?php // If comments are open or we have at least one comment, load up the comment template if (onehost_theme_option('portfolio_comments')) { comments_template(); } ?> <?php } // end of the loop. ?> </main><!-- #main --> </div><!-- #primary --> <?php get_footer();
/** * Get socials value * * @since 1.0 * * @return string */ function onehost_socials() { $html = ''; $socials = array_filter((array) onehost_theme_option('social')); if (empty($socials)) { return false; } foreach ($socials as $social => $url) { $display_name = $social; if ($social == 'googleplus') { $display_name = 'google+'; $social = 'google-plus'; } $html .= '<a href="' . esc_url($url) . '" target="_blank" class="' . esc_attr($social) . '"><i class="fa fa-' . $social . '"></i></a>'; } echo '<div class="social-icons">' . $html . '</div>'; }
?> <div class="site-info clearfix"> <div class="container"> <?php onehost_socials(); ?> <?php echo wpautop(onehost_theme_option('footer_copyright')); ?> <a id="scroll-top" class="backtotop" href="#page-top"> <i class="fa fa-arrow-up"></i> </a> </div> </div><!-- .site-info --> <?php if (onehost_theme_option('preloader')) { ?> <div id="loader"> <div class="loader"></div> </div> <?php } ?> </footer><!-- #site-footer --> </div><!-- #wrap --> <?php wp_footer(); ?> </body>
<?php wp_head(); ?> </head> <body <?php body_class(); ?> > <div id="wrap" class="hfeed site"> <header id="site-header" class="site-header" role="banner"> <div class="container"> <div class="site-branding clearfix"> <?php $logo = onehost_theme_option('logo'); if (!$logo) { $logo = THEME_URL . '/img/logo.png'; } ?> <a href="<?php echo esc_url(home_url()); ?> " class="logo"><img src="<?php echo esc_url($logo); ?> " alt="logo"></a> <?php printf('<%1$s class="site-title"><a href="%2$s" rel="home">%3$s</a></%1$s>', is_home() ? 'h1' : 'p', esc_url(home_url('/')), get_bloginfo('name')); ?> <p class="site-description"><?php