Exemplo n.º 1
0
function barcelona_header_custom_code()
{
    $barcelona_extra_fonts = array();
    if (is_active_widget(false, false, 'barcelona-about-me')) {
        $barcelona_extra_fonts = array('Old+Standard+TT');
    }
    $barcelona_font = barcelona_get_font($barcelona_extra_fonts);
    $barcelona_background = barcelona_get_background();
    $barcelona_options = barcelona_get_options(array('apple_touch_icon_iphone', 'apple_touch_icon_ipad', 'apple_touch_icon_retina', 'favicon_url', 'header_custom_code', 'css_custom_code', 'selection_color', 'facebook_app_id', 'add_facebook_og_tags'));
    if (!empty($barcelona_options['apple_touch_icon_iphone'])) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="57x57" href="' . esc_url($barcelona_options['apple_touch_icon_iphone']) . '" />' . "\n";
    }
    if (!empty($barcelona_options['apple_touch_icon_ipad'])) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="72x72" href="' . esc_url($barcelona_options['apple_touch_icon_ipad']) . '" />' . "\n";
    }
    if (!empty($barcelona_options['apple_touch_icon_retina'])) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="144x144" href="' . esc_url($barcelona_options['apple_touch_icon_retina']) . '" />' . "\n";
    }
    if (!empty($barcelona_options['favicon_url'])) {
        echo '<link rel="icon" href="' . esc_url($barcelona_options['favicon_url']) . '" />' . "\n";
    }
    if ($barcelona_options['add_facebook_og_tags'] == 'on' && is_singular()) {
        global $post;
        $barcelona_author_social_links = barcelona_get_author_social_links($post->post_author);
        ?>
		<meta property="og:title" content="<?php 
        echo esc_attr($post->post_title);
        ?>
" />
		<meta property="og:site_name" content="<?php 
        echo esc_attr(get_bloginfo('name'));
        ?>
" />
		<meta property="og:url" content="<?php 
        echo esc_url(get_the_permalink($post->ID));
        ?>
" />
		<meta property="og:description" content="<?php 
        echo esc_attr(barcelona_get_excerpt(60));
        ?>
" />
		<?php 
        if (!empty($barcelona_options['facebook_app_id'])) {
            ?>
		<meta property="fb:app_id" content="<?php 
            echo esc_attr($barcelona_options['facebook_app_id']);
            ?>
" />
		<?php 
        }
        ?>
		<meta property="og:type" content="article" />
		<meta property="og:locale" content="<?php 
        echo esc_attr(barcelona_get_locale());
        ?>
" />
		<?php 
        if (has_post_thumbnail()) {
            ?>
		<meta property="og:image" content="<?php 
            barcelona_thumbnail_url('barcelona-lg');
            ?>
" />
		<?php 
            if (array_key_exists('facebook', $barcelona_author_social_links)) {
                ?>
		<meta property="article:author" content="<?php 
                echo esc_url($barcelona_author_social_links['facebook']['href']);
                ?>
" />
		<meta property="article:publisher" content="<?php 
                echo esc_url($barcelona_author_social_links['facebook']['href']);
                ?>
" />
		<?php 
            }
            ?>
		<?php 
        }
    }
    // Add header custom code
    if (!empty($barcelona_options['header_custom_code'])) {
        // We trust the author here. The author can add custom html to header.
        echo $barcelona_options['header_custom_code'] . "\n";
    }
    // Add body & heading font styles
    echo wp_kses($barcelona_font[1], array('style' => array('type' => array()))) . "\n";
    if (!empty($barcelona_background)) {
        $barcelona_options['css_custom_code'] .= "\n" . $barcelona_background;
    }
    if (!empty($barcelona_options['selection_color'])) {
        $barcelona_options['css_custom_code'] .= "\n::-moz-selection { background-color: " . esc_html($barcelona_options['selection_color']) . "; }\n::selection { background-color: " . esc_html($barcelona_options['selection_color']) . "; }";
    }
    // Add css custom code
    if (!empty($barcelona_options['css_custom_code'])) {
        echo "<style type=\"text/css\">\n" . esc_html($barcelona_options['css_custom_code']) . "\n</style>\n";
    }
}
Exemplo n.º 2
0
',
			<?php 
    }
    ?>
			status: true,
			xfbml: true,
			version: 'v2.3'
		});
	};

	(function(d, s, id){
		var js, fjs = d.getElementsByTagName(s)[0];
		if (d.getElementById(id)) {return;}
		js = d.createElement(s); js.id = id;
		js.src = "//connect.facebook.net/<?php 
    echo barcelona_get_locale();
    ?>
/sdk.js";
		fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));
</script>
<?php 
}
?>

<nav class="<?php 
echo esc_attr(barcelona_nav_class());
?>
">

	<div class="container">