Beispiel #1
0
/**
 * Get layout base on current page
 *
 * @return string
 */
function bigboom_get_layout()
{
    $layout = bigboom_theme_option('default_layout');
    if (is_singular() && bigboom_get_meta('custom_layout')) {
        $layout = bigboom_get_meta('layout');
    } elseif (is_page()) {
        $layout = bigboom_theme_option('page_layout');
    } elseif (function_exists('is_woocommerce') && is_woocommerce()) {
        $layout = bigboom_theme_option('shop_layout');
    } elseif (is_404()) {
        $layout = 'full-content';
    }
    return $layout;
}
Beispiel #2
0
/**
 * The template used for displaying page content in page.php
 *
 * @package BigBoom
 */
?>

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
	<?php 
if (!bigboom_get_meta('hide_singular_title')) {
    ?>
		<header class="entry-header">
			<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
		</header><!-- .entry-header -->
	<?php 
}
?>

	<div class="entry-content">
		<?php 
the_content();
?>
Beispiel #3
0
/**
 * Custom scripts and styles on header
 *
 * @since  1.0
 */
function bigboom_header_scripts()
{
    $inline_css = '';
    // Promotion
    if (intval(bigboom_theme_option('promotion'))) {
        $promo_bg = bigboom_theme_option('promo_bg');
        $promo_css = "background-position: {$promo_bg['position_x']} {$promo_bg['position_x']};";
        $promo_css .= "background-repeat: {$promo_bg['repeat']};";
        $promo_css .= "background-attachment: {$promo_bg['attachment']};";
        $promo_css .= !empty($promo_bg['image']) ? "background-image: url({$promo_bg['image']});" : '';
        $promo_css .= !empty($promo_bg['color']) ? "background-color: {$promo_bg['color']};" : '';
        $promo_css .= !empty($promo_bg['size']) ? "background-size: {$promo_bg['size']};" : '';
        $inline_css .= '.top-promotion {' . $promo_css . '}';
    }
    // Custom CSS
    $css_custom = bigboom_get_meta('custom_css') . bigboom_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>';
    }
    if ($inline_css) {
        echo $inline_css;
    }
    // Custom javascript
    if ($header_js = bigboom_theme_option('header_scripts')) {
        echo $header_js;
    }
    if (is_singular() && ($custom_js = bigboom_get_meta('custom_js'))) {
        echo $custom_js;
    }
}
Beispiel #4
0
/**
 * Show entry thumbnail base on its format
 *
 * @since  1.0
 */
function bigboom_entry_thumbnail($size = 'blog-thumb')
{
    $html = '';
    $css_class = '';
    if ('full-content' == bigboom_get_layout()) {
        $size = 'blog-large-thumb';
    }
    $size = apply_filters('bigboom_post_format_thumbnail_size', $size);
    switch (get_post_format()) {
        case 'image':
            $image = bigboom_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>', esc_url(get_permalink()), the_title_attribute('echo=0'), esc_url($image));
            break;
        case 'gallery':
            $images = bigboom_get_meta('images', "type=image&size={$size}");
            if (empty($images)) {
                break;
            }
            $gallery = array();
            foreach ($images as $image) {
                $gallery[] = '<li>' . '<img src="' . esc_url($image['url']) . '" alt="' . the_title_attribute('echo=0') . '">' . '</li>';
            }
            $html .= '<div class="flexslider entry-image"><ul class="slides">' . implode('', $gallery) . '</ul></div>';
            break;
        case 'audio':
            $audio = bigboom_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':
            $video = bigboom_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'] = bigboom_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="' . esc_url(get_permalink()) . '">' . $thumb . '</a>';
            }
            $link = bigboom_get_meta('url');
            $text = bigboom_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 = bigboom_get_meta('quote');
            $author = bigboom_get_meta('quote_author');
            $author_url = bigboom_get_meta('author_url');
            if (!$quote) {
                break;
            }
            $html .= sprintf('<blockquote>%s<cite>%s</cite></blockquote>', esc_html($quote), empty($author_url) ? $author : '<a href="' . esc_url($author_url) . '"> - ' . $author . '</a>');
            break;
        default:
            $thumb = bigboom_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>";
    }
}