Exemplo n.º 1
0
function hocwp_addthis_script($args = array())
{
    $id = isset($args['id']) ? $args['id'] : '';
    if (empty($id)) {
        $id = hocwp_option_get_value('option_social', 'addthis_id');
    }
    if (empty($id)) {
        $use_default_addthis_id = apply_filters('hocwp_use_default_addthis_id', false);
        if ($use_default_addthis_id) {
            $id = 'ra-4e8109ea4780ac8d';
        }
    }
    $id = apply_filters('hocwp_addthis_id', $id);
    if (empty($id)) {
        return;
    }
    ?>
	<!-- Go to www.addthis.com/dashboard to customize your tools -->
	<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php 
    echo $id;
    ?>
"
	        async="async"></script>
	<?php 
}
Exemplo n.º 2
0
function hocwp_get_post_thumbnail_url($post_id = '', $size = 'full')
{
    $result = '';
    if (empty($post_id)) {
        $post_id = get_the_ID();
    }
    if (has_post_thumbnail($post_id)) {
        $thumbnail_id = get_post_thumbnail_id($post_id);
        if (hocwp_media_file_exists($thumbnail_id)) {
            $image_attributes = wp_get_attachment_image_src($thumbnail_id, $size);
            if ($image_attributes) {
                $result = $image_attributes[0];
            }
        }
    }
    if (empty($result)) {
        $result = get_post_meta($post_id, 'thumbnail_url', true);
    }
    $result = apply_filters('hocwp_post_thumbnail_pre_from_content', $result, $post_id, $size);
    if (empty($result)) {
        $post = get_post($post_id);
        if (hocwp_object_valid($post)) {
            $result = hocwp_get_first_image_source($post->post_content);
        }
    }
    $result = apply_filters('hocwp_post_pre_post_thumbnail', $result, $post_id);
    if (empty($result)) {
        $thumbnail = hocwp_option_get_value('writing', 'default_post_thumbnail');
        $thumbnail = hocwp_sanitize_media_value($thumbnail);
        $result = $thumbnail['url'];
    }
    if (empty($result)) {
        $no_thumbnail = HOCWP_URL . '/images/no-thumbnail.png';
        $no_thumbnail = apply_filters('hocwp_no_thumbnail_url', $no_thumbnail);
        $result = $no_thumbnail;
    }
    $result = apply_filters('hocwp_post_thumbnail', $result, $post_id);
    return $result;
}
Exemplo n.º 3
0
function hocwp_get_google_client_id()
{
    $clientid = hocwp_option_get_value('option_social', 'google_client_id');
    $clientid = apply_filters('hocwp_google_client_id', $clientid);
    return $clientid;
}
Exemplo n.º 4
0
function hocwp_theme_switcher_default_mobile_theme_name()
{
    $name = hocwp_option_get_value('theme_switcher', 'mobile_theme');
    $name = apply_filters('hocwp_mobile_theme', $name);
    return $name;
}
function hocwp_setup_theme_localize_script_object_args($args)
{
    $button_style = hocwp_option_get_value('hocwp_user_login', 'button_style');
    if (!is_array($args)) {
        $args = array();
    }
    if (empty($button_style)) {
        $button_style = 'warning';
    }
    $args['logins']['button_style'] = $button_style;
    $button_style = hocwp_option_get_value('hocwp_discussion', 'button_style');
    if (empty($button_style)) {
        $button_style = 'warning';
    }
    $args['discussions']['button_style'] = $button_style;
    return $args;
}
Exemplo n.º 6
0
function hocwp_search_query_tracking()
{
    $use = hocwp_option_get_value('reading', 'search_tracking');
    $use = apply_filters('hocwp_search_query_tracking', $use);
    return (bool) $use;
}
Exemplo n.º 7
0
function hocwp_get_language()
{
    global $hocwp_language;
    if (empty($hocwp_language) || !is_string($hocwp_language)) {
        $lang = hocwp_option_get_value('theme_setting', 'language');
        if (empty($lang)) {
            $lang = 'vi';
        }
        $hocwp_language = $lang;
    }
    $hocwp_language = apply_filters('hocwp_language', $hocwp_language);
    return $hocwp_language;
}
Exemplo n.º 8
0
function hocwp_theme_get_option($key, $base = 'theme_setting')
{
    return hocwp_option_get_value($base, $key);
}