Example #1
0
/**
 * 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;
}
Example #2
0
/**
 * Get Bootstrap column classes for content area
 *
 * @since  1.0
 *
 * @return array Array of classes
 */
function onehost_get_content_columns($layout = null)
{
    $layout = $layout ? $layout : onehost_get_layout();
    if ('full-content' == $layout) {
        return array('col-md-12');
    }
    return array('col-md-8', 'col-sm-8', 'col-xs-12');
}
Example #3
0
<?php

/**
 * The Sidebar containing the main widget areas.
 *
 * @package Onehost
 */
if ('full-content' == onehost_get_layout()) {
    return;
}
?>
<aside id="secondary" class="widgets-area col-md-4" role="complementary">
	<?php 
if (!dynamic_sidebar('primary-sidebar')) {
    ?>

		<div id="search" class="widget widget_search">
			<?php 
    get_search_form();
    ?>
		</div>

		<div id="archives" class="widget">
			<h4 class="widget-title"><?php 
    _e('Archives', 'onehost');
    ?>
</h4>
			<ul>
				<?php 
    wp_get_archives(array('type' => 'monthly'));
    ?>
Example #4
0
/**
 * Show entry thumbnail base on its format
 *
 * @since  1.0
 */
function onehost_entry_thumbnail($size = 'blog-thumb')
{
    $html = '';
    $css_class = '';
    if ('full-content' == onehost_get_layout()) {
        $size = 'blog-full-thumb';
    }
    $size = apply_filters('onehost_post_format_thumbnail_size', $size);
    switch (get_post_format()) {
        case 'image':
            $image = onehost_get_image(array('size' => $size, 'format' => 'src', 'meta_key' => 'image', 'echo' => false));
            if (!$image) {
                break;
            }
            $html = sprintf('<a class="entry-image" href="%1$s" title="%2$s"><img src="%3$s" alt="%2$s"></a>', get_permalink(), the_title_attribute('echo=0'), $image);
            break;
        case 'gallery':
            $images = onehost_get_meta('images', "type=image&size={$size}");
            if (empty($images)) {
                break;
            }
            $gallery = array();
            foreach ($images as $image) {
                $gallery[] = '<div class="entry-item">' . '<img src="' . $image['url'] . '" alt="' . the_title_attribute('echo=0') . '">' . '</div>';
            }
            $html .= '<div class="flexslider entry-image"><div class="slides">' . implode('', $gallery) . '</div></div>';
            break;
        case 'audio':
            $thumb = get_the_post_thumbnail(get_the_ID(), $size);
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            }
            $audio = onehost_get_meta('audio');
            if (!$audio) {
                break;
            }
            // If URL: show oEmbed HTML or jPlayer
            if (filter_var($audio, FILTER_VALIDATE_URL)) {
                // Try oEmbed first
                if ($oembed = @wp_oembed_get($audio)) {
                    $html .= $oembed;
                } else {
                    $html .= '<div class="audio-player">' . wp_audio_shortcode(array('src' => $audio)) . '</div>';
                }
            } else {
                $html .= $audio;
            }
            break;
        case 'video':
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            }
            $video = onehost_get_meta('video');
            if (!$video) {
                break;
            }
            // If URL: show oEmbed HTML
            if (filter_var($video, FILTER_VALIDATE_URL)) {
                if ($oembed = @wp_oembed_get($video)) {
                    $html .= $oembed;
                } else {
                    $atts = array('src' => $video, 'width' => 848);
                    if (has_post_thumbnail()) {
                        $atts['poster'] = onehost_get_image('format=src&echo=0&size=full');
                    }
                    $html .= wp_video_shortcode($atts);
                }
            } else {
                $html .= $video;
            }
            break;
        case 'link':
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            }
            $link = onehost_get_meta('url');
            $text = onehost_get_meta('url_text');
            if (!$link) {
                break;
            }
            $html .= sprintf('<a href="%s" class="link-block">%s</a>', esc_url($link), $text ? $text : $link);
            break;
        case 'quote':
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            }
            $quote = onehost_get_meta('quote');
            $author = onehost_get_meta('quote_author');
            $author_url = onehost_get_meta('author_url');
            if (!$quote) {
                break;
            }
            $html .= sprintf('<blockquote>%s<cite>%s</cite></blockquote>', esc_html($quote), empty($author_url) ? $author : "<a href='{$author_url}'> - {$author}</a>");
            break;
        default:
            $thumb = onehost_get_image(array('size' => $size, 'meta_key' => 'image', 'echo' => false));
            if (empty($thumb)) {
                break;
            }
            $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            break;
    }
    if ($html = apply_filters(__FUNCTION__, $html, get_post_format())) {
        echo "<div class='entry-format'>{$html}</div>";
    }
}