Exemple #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";
    }
}
function barcelona_author_box($barcelona_author_id = NULL, $is_inverse = TRUE)
{
    if (barcelona_get_option('show_author_box') != 'on') {
        return;
    }
    if (is_null($barcelona_author_id)) {
        $barcelona_obj = get_queried_object();
        $barcelona_author_id = is_author() ? $barcelona_obj->data->ID : get_the_author_meta('ID');
        if (empty($barcelona_author_id)) {
            return;
        }
    }
    $barcelona_author_social_links = barcelona_get_author_social_links($barcelona_author_id);
    $barcelona_is_template = is_page_template('page-authors.php');
    $barcelona_cls = array('author-box');
    if ($is_inverse) {
        $barcelona_cls[] = 'author-box-inverse';
    }
    ?>
	<div class="<?php 
    echo implode(' ', $barcelona_cls);
    ?>
">

		<div class="author-image">
			<?php 
    if ($barcelona_is_template) {
        echo '<a href="' . esc_url(get_author_posts_url($barcelona_author_id)) . '" rel="author">';
    }
    echo get_avatar(get_the_author_meta('user_email', $barcelona_author_id), 164);
    if ($barcelona_is_template) {
        echo '</a>';
    }
    ?>
		</div>

		<div class="author-details">

			<span class="author-name">
				<a href="<?php 
    echo esc_url(get_author_posts_url($barcelona_author_id));
    ?>
" rel="author">
					<?php 
    the_author_meta('display_name', $barcelona_author_id);
    ?>
				</a>
			</span>

			<span class="author-title">
				<?php 
    the_author_meta('job_title', $barcelona_author_id);
    ?>
			</span>

			<?php 
    if (is_array($barcelona_author_social_links)) {
        ?>
			<ul class="author-social list-inline">
				<?php 
        foreach ($barcelona_author_social_links as $v) {
            ?>
					<li>
						<a href="<?php 
            echo esc_url($v['href']);
            ?>
">
							<span class="fa fa-<?php 
            echo sanitize_html_class($v['icon']);
            ?>
"></span>
						</a>
					</li>
				<?php 
        }
        ?>
			</ul>
		<?php 
    }
    ?>

			<p class="author-desc">
				<?php 
    the_author_meta('description', $barcelona_author_id);
    ?>
			</p>

		</div><!-- .author-details -->

	</div><!-- .author-box -->
	<?php 
}