/**
  * Get thumbnail image url
  *
  * @param null|\WP_Post $_post Post data object.
  *
  * @return string
  */
 public static function get_thumbnail($_post = null)
 {
     $thumb = apply_filters(VA_SOCIALBUZZ_PREFIX . 'default_thumbnail', 'none');
     if (empty($_post)) {
         global $post;
         $_post = $post;
     }
     if (!empty($_post) && has_post_thumbnail($_post) && !post_password_required($_post)) {
         $thumb = get_the_post_thumbnail_url($_post, VA_SOCIALBUZZ_PREFIX . 'thumbnail');
     } elseif ('none' === $thumb && has_header_image()) {
         $thumb = get_header_image();
     } elseif ('none' === $thumb && has_site_icon()) {
         $thumb = get_site_icon_url();
     }
     return $thumb;
 }
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function twentyseventeen_body_classes($classes)
{
    // Add class of group-blog to blogs with more than 1 published author.
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    // Add class of hfeed to non-singular pages.
    if (!is_singular()) {
        $classes[] = 'hfeed';
    }
    // Add class if we're viewing the Customizer for easier styling of theme options.
    if (is_customize_preview()) {
        $classes[] = 'twentyseventeen-customizer';
    }
    // Add class on front page.
    if (is_front_page() && 'posts' !== get_option('show_on_front')) {
        $classes[] = 'twentyseventeen-front-page';
    }
    // Add a class if there is a custom header.
    if (has_header_image() || has_header_video() && is_front_page()) {
        $classes[] = 'has-header-image';
    }
    // Add class if sidebar is used.
    if (is_active_sidebar('sidebar-1') && !is_page()) {
        $classes[] = 'has-sidebar';
    }
    // Add class for one or two column page layouts.
    if (is_page() || is_archive()) {
        if ('one-column' === get_theme_mod('page_layout')) {
            $classes[] = 'page-one-column';
        } else {
            $classes[] = 'page-two-column';
        }
    }
    // Add class if the site title and tagline is hidden.
    if ('blank' === get_header_textcolor()) {
        $classes[] = 'title-tagline-hidden';
    }
    // Get the colorscheme or the default if there isn't one.
    $colors = twentyseventeen_sanitize_colorscheme(get_theme_mod('colorscheme', 'light'));
    $classes[] = 'colors-' . $colors;
    return $classes;
}
Exemple #3
0
 <div class="container">
    <?php 
if (has_header_image()) {
    ?>
    <img class="img-fluid" src="<?php 
    echo get_header_image();
    ?>
" alt="<?php 
    echo get_bloginfo('title');
    ?>
" />
    <?php 
}
?>
    <div class="jumbotron" id="header">
     <?php 
$homeurl = ".get_bloginfo('template_directory').";
if ($sa_settings['intro_text'] != '') {
    echo $sa_settings['intro_text'];
} else {
    include 'jumbotron-defaults.php';
}
?>
    </div>
  </div>

Exemple #4
0
/**
 * Custom CSS for wp_head
 */
function latte_custom_css()
{
    $latte_intro_display = get_theme_mod('latte_intro_display');
    $latte_about_display = get_theme_mod('latte_about_display');
    $latte_social_display = get_theme_mod('latte_social_display');
    $latte_services_display = get_theme_mod('latte_services_display');
    $latte_subscribe_display = get_theme_mod('latte_subscribe_display', 1);
    $latte_skills_display = get_theme_mod('latte_skills_display');
    $latte_blogposts_display = get_theme_mod('latte_blogposts_display');
    $latte_intro_background_color = get_theme_mod('latte_intro_background_color', 'rgba(0, 0, 0, 0.7)');
    $latte_about_background_color = get_theme_mod('latte_about_background_color', '#F5F5F5');
    $latte_social_background_color = get_theme_mod('latte_social_background_color', 'rgba(0, 0, 0, 0.7)');
    $latte_services_background_color = get_theme_mod('latte_services_background_color', '#F5F5F5');
    $latte_subscribe_background_color = get_theme_mod('latte_subscribe_background_color', 'rgba(0, 0, 0, 0.7)');
    $latte_skills_background_color = get_theme_mod('latte_skills_background_color', '#F5F5F5');
    $latte_blogposts_background_color = get_theme_mod('latte_blogposts_background_color', '#F5F5F5');
    ?>
<style>
<?php 
    if (is_page_template('template-home.php')) {
        if (isset($latte_intro_display) && $latte_intro_display != 1) {
            if (!empty($latte_intro_background_color)) {
                ?>
.intro {
	background: <?php 
                echo esc_html($latte_intro_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_about_display) && $latte_about_display != 1) {
            if (!empty($latte_about_background_color)) {
                ?>
.about {
	background: <?php 
                echo esc_html($latte_about_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_social_display) && $latte_social_display != 1) {
            if (!empty($latte_social_background_color)) {
                ?>
.social {
	background: <?php 
                echo esc_html($latte_social_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_services_display) && $latte_services_display != 1) {
            if (!empty($latte_services_background_color)) {
                ?>
.services {
	background: <?php 
                echo esc_html($latte_services_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_subscribe_display) && $latte_subscribe_display != 1) {
            if (!empty($latte_subscribe_background_color)) {
                ?>
.subscribe {
	background: <?php 
                echo esc_html($latte_subscribe_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_skills_display) && $latte_skills_display != 1) {
            if (!empty($latte_skills_background_color)) {
                ?>
.skills {
	background: <?php 
                echo esc_html($latte_skills_background_color);
                ?>
;
}
<?php 
            }
        }
        if (isset($latte_blogposts_display) && $latte_blogposts_display != 1) {
            if (!empty($latte_blogposts_background_color)) {
                ?>
.blogposts {
	background: <?php 
                echo esc_html($latte_blogposts_background_color);
                ?>
;
}
<?php 
            }
        }
    }
    if (has_header_image()) {
        ?>
.archive-header {
	background: transparent url("<?php 
        echo get_header_image();
        ?>
") repeat scroll center center / cover;
}
<?php 
    }
    ?>
</style>
<?php 
}
function expand_ratings_template($template, $post_data, $post_ratings_data = null, $max_post_title_chars = 0, $is_main_loop = true)
{
    global $post;
    // Get global variables
    $ratings_image = get_option('postratings_image');
    $ratings_max = intval(get_option('postratings_max'));
    $ratings_custom = intval(get_option('postratings_customrating'));
    $ratings_options = get_option('postratings_options');
    if (is_object($post_data)) {
        $post_id = $post_data->ID;
    } else {
        $post_id = $post_data;
    }
    // Most likely from coming from Widget
    if (isset($post_data->ratings_users)) {
        $post_ratings_users = intval($post_data->ratings_users);
        $post_ratings_score = intval($post_data->ratings_score);
        $post_ratings_average = floatval($post_data->ratings_average);
        // Most Likely coming from the_ratings_vote or the_ratings_rate
    } else {
        if (isset($post_ratings_data->ratings_users)) {
            $post_ratings_users = intval($post_ratings_data->ratings_users);
            $post_ratings_score = intval($post_ratings_data->ratings_score);
            $post_ratings_average = floatval($post_ratings_data->ratings_average);
        } else {
            if (get_the_ID() != $post_id) {
                $post_ratings_data = get_post_custom($post_id);
            } else {
                $post_ratings_data = get_post_custom();
            }
            $post_ratings_users = is_array($post_ratings_data) && array_key_exists('ratings_users', $post_ratings_data) ? intval($post_ratings_data['ratings_users'][0]) : 0;
            $post_ratings_score = is_array($post_ratings_data) && array_key_exists('ratings_score', $post_ratings_data) ? intval($post_ratings_data['ratings_score'][0]) : 0;
            $post_ratings_average = is_array($post_ratings_data) && array_key_exists('ratings_average', $post_ratings_data) ? floatval($post_ratings_data['ratings_average'][0]) : 0;
        }
    }
    if ($post_ratings_score == 0 || $post_ratings_users == 0) {
        $post_ratings = 0;
        $post_ratings_average = 0;
        $post_ratings_percentage = 0;
    } else {
        $post_ratings = round($post_ratings_average, 1);
        $post_ratings_percentage = round($post_ratings_score / $post_ratings_users / $ratings_max * 100, 2);
    }
    $post_ratings_text = '<span class="post-ratings-text" id="ratings_' . $post_id . '_text"></span>';
    // Get the image's alt text
    if ($ratings_custom && $ratings_max == 2) {
        if ($post_ratings_score > 0) {
            $post_ratings_score = '+' . $post_ratings_score;
        }
        $post_ratings_alt_text = sprintf(_n('%s rating', '%s ratings', $post_ratings_score, 'wp-postratings'), number_format_i18n($post_ratings_score)) . __(',', 'wp-postratings') . ' ' . sprintf(_n('%s vote', '%s votes', $post_ratings_users, 'wp-postratings'), number_format_i18n($post_ratings_users));
    } else {
        $post_ratings_score = number_format_i18n($post_ratings_score);
        $post_ratings_alt_text = sprintf(_n('%s vote', '%s votes', $post_ratings_users, 'wp-postratings'), number_format_i18n($post_ratings_users)) . __(',', 'wp-postratings') . ' ' . __('average', 'wp-postratings') . ': ' . number_format_i18n($post_ratings_average, 2) . ' ' . __('out of', 'wp-postratings') . ' ' . number_format_i18n($ratings_max);
    }
    // Check for half star
    $insert_half = 0;
    $average_diff = abs(floor($post_ratings_average) - $post_ratings);
    if ($average_diff >= 0.25 && $average_diff <= 0.75) {
        $insert_half = ceil($post_ratings_average);
    } elseif ($average_diff > 0.75) {
        $insert_half = ceil($post_ratings);
    }
    // Replace the variables
    $value = $template;
    if (strpos($template, '%RATINGS_IMAGES%') !== false) {
        $get_ratings_images = get_ratings_images($ratings_custom, $ratings_max, $post_ratings, $ratings_image, $post_ratings_alt_text, $insert_half);
        $post_ratings_images = apply_filters('wp_postratings_ratings_images', $get_ratings_images, $post_id, $post_ratings, $ratings_max);
        $value = str_replace("%RATINGS_IMAGES%", $post_ratings_images, $value);
    }
    if (strpos($template, '%RATINGS_IMAGES_VOTE%') !== false) {
        $ratings_texts = get_option('postratings_ratingstext');
        $get_ratings_images_vote = get_ratings_images_vote($post_id, $ratings_custom, $ratings_max, $post_ratings, $ratings_image, $post_ratings_alt_text, $insert_half, $ratings_texts);
        $post_ratings_images = apply_filters('wp_postratings_ratings_images_vote', $get_ratings_images_vote, $post_id, $post_ratings, $ratings_max);
        $value = str_replace("%RATINGS_IMAGES_VOTE%", $post_ratings_images, $value);
    }
    $value = str_replace("%RATINGS_ALT_TEXT%", $post_ratings_alt_text, $value);
    $value = str_replace("%RATINGS_TEXT%", $post_ratings_text, $value);
    $value = str_replace("%RATINGS_MAX%", number_format_i18n($ratings_max), $value);
    $value = str_replace("%RATINGS_SCORE%", $post_ratings_score, $value);
    $value = str_replace("%RATINGS_AVERAGE%", number_format_i18n($post_ratings_average, 2), $value);
    $value = str_replace("%RATINGS_PERCENTAGE%", number_format_i18n($post_ratings_percentage, 2), $value);
    $value = str_replace("%RATINGS_USERS%", number_format_i18n($post_ratings_users), $value);
    // Post Template Variables
    $post_link = get_permalink($post_data);
    $post_title = get_the_title($post_data);
    if ($max_post_title_chars > 0) {
        $post_title = snippet_text($post_title, $max_post_title_chars);
    }
    $value = str_replace("%POST_ID%", $post_id, $value);
    $value = str_replace("%POST_TITLE%", $post_title, $value);
    $value = str_replace("%POST_URL%", $post_link, $value);
    if (strpos($template, '%POST_EXCERPT%') !== false) {
        if (get_the_ID() != $post_id) {
            $post =& get_post($post_id);
        }
        $post_excerpt = ratings_post_excerpt($post_id, $post->post_excerpt, $post->post_content, $post->post_password);
        $value = str_replace("%POST_EXCERPT%", $post_excerpt, $value);
    }
    if (strpos($template, '%POST_CONTENT%') !== false) {
        if (get_the_ID() != $post_id) {
            $post =& get_post($post_id);
        }
        $value = str_replace("%POST_CONTENT%", get_the_content(), $value);
    }
    // Google Rich Snippet
    $ratings_options['richsnippet'] = isset($ratings_options['richsnippet']) ? $ratings_options['richsnippet'] : 1;
    if ($ratings_options['richsnippet'] && (is_single() || is_page()) && $is_main_loop) {
        $itemtype = apply_filters('wp_postratings_schema_itemtype', 'itemscope itemtype="http://schema.org/Article"');
        if (empty($post_excerpt)) {
            $post_excerpt = ratings_post_excerpt($post_id, $post->post_excerpt, $post->post_content, $post->post_password);
        }
        $post_meta = '<meta itemprop="headline" content="' . esc_attr($post_title) . '" />';
        $post_meta .= '<meta itemprop="description" content="' . wp_kses($post_excerpt, array()) . '" />';
        $post_meta .= '<meta itemprop="datePublished" content="' . mysql2date('c', $post->post_date, false) . '" />';
        $post_meta .= '<meta itemprop="dateModified" content="' . mysql2date('c', $post->post_modified, false) . '" />';
        $post_meta .= '<meta itemprop="url" content="' . $post_link . '" />';
        $post_meta .= '<meta itemprop="author" content="' . get_the_author() . '" />';
        $post_meta .= '<meta itemprop="mainEntityOfPage" content="' . get_permalink() . '" />';
        // Image
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(null));
            if (!empty($thumbnail)) {
                $post_meta .= '<div style="display: none;" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">';
                $post_meta .= '<meta itemprop="url" content="' . $thumbnail[0] . '" />';
                $post_meta .= '<meta itemprop="width" content="' . $thumbnail[1] . '" />';
                $post_meta .= '<meta itemprop="height" content="' . $thumbnail[2] . '" />';
                $post_meta .= '</div>';
            }
        }
        // Publisher
        $site_logo = '';
        if (has_header_image()) {
            $header_image = get_header_image();
            if (!empty($header_image)) {
                $site_logo = $header_image;
            }
        }
        $site_logo = apply_filters('wp_postratings_site_logo', $site_logo);
        $post_meta .= '<div style="display: none;" itemprop="publisher" itemscope itemtype="https://schema.org/Organization">';
        $post_meta .= '<meta itemprop="name" content="' . get_bloginfo('name') . '" />';
        $post_meta .= '<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">';
        $post_meta .= '<meta itemprop="url" content="' . $site_logo . '" />';
        $post_meta .= '</div>';
        $post_meta .= '</div>';
        $ratings_meta = '';
        if ($post_ratings_average > 0) {
            $ratings_meta .= '<div style="display: none;" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
            $ratings_meta .= '<meta itemprop="bestRating" content="' . $ratings_max . '" />';
            $ratings_meta .= '<meta itemprop="worstRating" content="1" />';
            $ratings_meta .= '<meta itemprop="ratingValue" content="' . $post_ratings_average . '" />';
            $ratings_meta .= '<meta itemprop="ratingCount" content="' . $post_ratings_users . '" />';
            $ratings_meta .= '</div>';
        }
        $value = empty($itemtype) ? $value . $ratings_meta : $value . $post_meta . $ratings_meta;
    }
    return apply_filters('expand_ratings_template', $value);
}
Exemple #6
0
 function origami_header_image()
 {
     if (function_exists('has_custom_logo') && has_custom_logo()) {
         $logo = get_custom_logo();
         if (!empty($logo)) {
             echo $logo;
             return true;
         }
     }
     if (function_exists('has_header_image') && has_header_image()) {
         $header = get_custom_header();
         echo '<img src="' . esc_url($header->url) . '"';
         if (!empty($header->height)) {
             echo ' height="' . $header->height . '"';
         }
         if (!empty($header->width)) {
             echo ' width="' . $header->width . '"';
         }
         echo ' alt="' . esc_attr(get_bloginfo('name')) . '" />';
         return true;
     }
     return false;
 }
/**
 * Check whether a custom header is set or not.
 *
 * @since 4.7.0
 *
 * @return bool True if a custom header is set. False if not.
 */
function has_custom_header()
{
    if (has_header_image() || is_front_page() && has_header_video()) {
        return true;
    }
    return false;
}
Exemple #8
0
 function wputh_display_title()
 {
     $main_tag = is_home() ? 'h1' : 'div';
     $main_tag_classname = 'h1 main-title';
     $title_content = get_bloginfo('name');
     if (has_header_image()) {
         $title_content = '<img src="' . get_header_image() . '" alt="' . esc_attr($title_content) . '" />';
         $main_tag_classname .= ' main-logo';
     }
     echo '<' . $main_tag . ' class="' . $main_tag_classname . '"><a href="' . home_url() . '">' . $title_content . '</a></' . $main_tag . '>';
 }
Exemple #9
0
/**
 * Adds custom classes to the array of body classes.
 *
 * @filter body_class
 * @since  1.0.0
 *
 * @param  array $classes
 *
 * @return array
 */
function rock_body_class(array $classes)
{
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    if (has_header_image()) {
        $classes[] = 'custom-header-image';
    }
    return $classes;
}
/**
 * Check whether a custom header is set or not.
 *
 * @since 4.7.0
 *
 * @return bool True if a custom header is set. False if not.
 */
function has_custom_header()
{
    if (has_header_image() || has_header_video() && is_header_video_active()) {
        return true;
    }
    return false;
}
Exemple #11
0
/**
 * Return the hero image URL.
 *
 * @since 1.0.0
 *
 * @return string|null
 */
function rock_get_hero_image()
{
    /**
     * Filter the hero image size.
     *
     * @since 1.0.0
     *
     * @var string
     */
    $size = (string) apply_filters('rock_hero_image_size', 'rock-hero');
    /**
     * Featured Image (if enabled)
     */
    if (rock_use_featured_hero_image() && ($post = get_queried_object()) && has_post_thumbnail($post)) {
        $image = wp_get_attachment_image_src(get_post_thumbnail_id($post), $size);
        if (isset($image[0])) {
            return $image[0];
        }
    }
    /**
     * Header Image
     */
    if (has_header_image()) {
        $header = get_custom_header();
        if (!empty($header->attachment_id)) {
            $image = wp_get_attachment_image_src($header->attachment_id, $size);
            if (isset($image[0])) {
                return $image[0];
            }
        }
        return get_header_image();
    }
}
Exemple #12
0
=================================================
*/
do_action('flat_responsive_wrapper_choose', 'flat-responsive');
/*
=================================================
Top Bar Customizer
=================================================
*/
do_action('flat_responsive_social_icons_top', 'flat-responsive');
/*
=======================================================
Fr Header Display with logo and Menu and Search Icons
=======================================================
*/
do_action('flat_responsive_header', 'flat-responsive');
if (has_header_image() || is_active_sidebar('banner')) {
    ?>
    <aside id="fr-banner" class="fr_responsive_banner" style="background-color: <?php 
    echo esc_html(get_theme_mod('banner_bg', '#c6b274'));
    ?>
; <?php 
    if (get_header_image()) {
        ?>
background-image: url(<?php 
        header_image();
        ?>
);<?php 
    }
    if (get_post_meta($post->ID, 'header_background', true)) {
        ?>
 background-image: url(<?php 
                        <span class="screen-reader-text"><?php 
    _e('Menu', 'smallblog');
    ?>
</span>
                    </a>
                </div>
            <?php 
}
?>
        </div>
    </div>
</header>


<?php 
if (is_home() and has_header_image()) {
    ?>
    <div id="banner" style="background-image: url(<?php 
    header_image();
    ?>
);">
        <img src="<?php 
    header_image();
    ?>
" alt="<?php 
    echo esc_attr(get_bloginfo('description', 'display'));
    ?>
"/>

        <?php 
    if (display_header_text()) {