function barcelona_register_sidebars() { register_sidebar(array('name' => esc_html__('Default Sidebar', 'barcelona'), 'id' => 'barcelona-default-sidebar', 'description' => esc_html__('This is default sidebar.', 'barcelona'), 'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h2 class="title">', 'after_title' => '</h2></div>')); $barcelona_opts = barcelona_get_options(array('sidebars', 'show_footer_sidebars')); if (is_array($barcelona_opts['sidebars'])) { foreach ($barcelona_opts['sidebars'] as $k => $v) { register_sidebar(array('name' => esc_html($v['title']), 'id' => 'barcelona-sidebar-' . intval($k + 1), 'description' => '', 'before_widget' => '<div id="%1$s" class="sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h2 class="title">', 'after_title' => '</h2></div>')); } } if ($barcelona_opts['show_footer_sidebars'] == 'on') { for ($i = 1; $i <= 3; $i++) { register_sidebar(array('name' => sprintf(esc_html__('Footer Sidebar %d', 'barcelona'), $i), 'id' => 'barcelona-footer-sidebar-' . intval($i), 'description' => '', 'before_widget' => '<div id="%1$s" class="footer-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h2 class="title">', 'after_title' => '</h2></div>')); } } if (function_exists('buddypress')) { register_sidebar(array('name' => esc_html__('BuddyPress Sidebar', 'barcelona'), 'id' => 'barcelona-buddypress-sidebar', 'description' => '', 'before_widget' => '<div id="%1$s" class="sidebar-widget bp-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h2 class="title">', 'after_title' => '</h2></div>')); } if (class_exists('bbPress')) { register_sidebar(array('name' => esc_html__('bbPress Sidebar', 'barcelona'), 'id' => 'barcelona-bbpress-sidebar', 'description' => '', 'before_widget' => '<div id="%1$s" class="sidebar-widget bbp-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title"><h2 class="title">', 'after_title' => '</h2></div>')); } }
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_post_ad() { $barcelona_ads = barcelona_get_options(array('show_post_content_ad', 'post_content_ad', 'post_content_ad_1', 'post_content_ad_2')); if ($barcelona_ads['show_post_content_ad'] == 'on' || $barcelona_ads['post_content_ad'] == 'custom') { foreach (array('lg', 'md') as $k => $v) { $barcelona_code = $barcelona_ads['post_content_ad_' . ($k + 1)]; if (!empty($barcelona_code)) { ?> <div class="content-bn visible-<?php echo sanitize_html_class($v) . ($v == 'lg' ? ' visible-sm' : ''); ?> "> <?php echo do_shortcode($barcelona_code); ?> </div> <?php } } } }
<?php $barcelona_opts = barcelona_get_options(array('show_footer_sidebars', 'show_footer_menu', 'show_footer_logo', 'footer_copyright_text')); if (!has_nav_menu('footer')) { $barcelona_opts['show_footer_menu'] = 'off'; } $barcelona_footer_bottom_classes = array('row', 'footer-bottom'); if ($barcelona_opts['show_footer_logo'] == 'on') { $barcelona_footer_bottom_classes[] = 'has-logo'; } if ($barcelona_opts['show_footer_menu'] == 'on') { $barcelona_footer_bottom_classes[] = 'has-menu'; } if (!empty($barcelona_opts['footer_copyright_text'])) { $barcelona_footer_bottom_classes[] = 'has-copy-text'; } ?> <footer class="<?php echo esc_attr(barcelona_footer_class()); ?> "> <div class="container"> <?php if ($barcelona_opts['show_footer_sidebars'] == 'on') { ?> <div class="row footer-sidebars"> <?php for ($i = 1; $i <= 3; $i++) { $barcelona_footer_sidebar = 'barcelona-footer-sidebar-' . intval($i);
function barcelona_get_font($extra_fonts = FALSE) { $barcelona_options = barcelona_get_options(array('font_headings', 'font_general', 'font_latin_ext', 'font_cyrillic_ext', 'font_greek_charset')); $barcelona_font_names = array($barcelona_options['font_general'] . ':400,700,400italic'); if ($barcelona_options['font_headings'] != $barcelona_options['font_general']) { $barcelona_font_names[] = $barcelona_options['font_headings'] . ':400,700'; } if (is_array($extra_fonts)) { $barcelona_font_names = array_merge($barcelona_font_names, $extra_fonts); } $barcelona_font_subset = array('latin'); if ($barcelona_options['font_cyrillic_ext'] == 'on') { $barcelona_font_subset[] = 'cyrillic,cyrillic-ext'; } if ($barcelona_options['font_latin_ext'] == 'on') { $barcelona_font_subset[] = 'latin-ext'; } if ($barcelona_options['font_greek_charset'] == 'on') { $barcelona_font_subset[] = 'greek,greek-ext'; } $barcelona_font_href = barcelona_get_protocol() . '//fonts.googleapis.com/css?family=' . implode('|', $barcelona_font_names); if (count($barcelona_font_subset) > 1) { $barcelona_font_href .= '&subset=' . implode(',', $barcelona_font_subset); } $result = array(esc_url($barcelona_font_href)); $barcelona_body_font_name = $barcelona_heading_font_name = strpos($barcelona_options['font_general'], "+") > 0 ? "'" . str_replace("+", " ", $barcelona_options['font_general']) . "'" : $barcelona_options['font_general']; if ($barcelona_options['font_headings'] != $barcelona_options['font_general']) { $barcelona_heading_font_name = strpos($barcelona_options['font_headings'], "+") > 0 ? "'" . str_replace("+", " ", $barcelona_options['font_headings']) . "'" : $barcelona_options['font_headings']; } $result[] = "<style type=\"text/css\">\nbody { font-family: " . esc_html($barcelona_body_font_name) . ", sans-serif; }\nh1,h2,h3,h4,h5,h6 { font-family: " . esc_html($barcelona_heading_font_name) . ", sans-serif; }\n</style>"; return $result; }
<?php $barcelona_top_bar = barcelona_get_options(array('show_top_bar_menu', 'show_header_social_icons')); if (!has_nav_menu('top')) { $barcelona_top_bar['show_top_bar_menu'] = 'off'; } $barcelona_social_icons = barcelona_social_icons(); if (empty($barcelona_social_icons)) { $barcelona_top_bar['show_header_social_icons'] = 'off'; } $barcelona_fb_app_id = barcelona_get_option('facebook_app_id'); ?> <!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" <?php language_attributes(); ?> > <![endif]--> <!--[if IE 7 ]><html class="ie ie7" <?php language_attributes(); ?> > <![endif]--> <!--[if IE 8 ]><html class="ie ie8" <?php language_attributes(); ?> > <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?> > <head>