B3THEME_URI . '/images/b3theme-logo.png')); register_nav_menus(array('primary' => __('Primary Menu', 'b3theme'),)); add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link')); add_theme_support('custom-background', apply_filters('b3theme_custom_background_args', array('default-color' => 'ffffff', 'default-image' => '',) )); add_theme_support('post-thumbnails'); add_filter('wp_nav_menu_container_allowedtags', 'b3theme_empty_array'); add_filter('wp_nav_menu_args', 'b3theme_wp_nav_menu_args'); require B3THEME_PATH . '/inc/options.php'; $b3theme_options = get_option('b3theme_options'); if (!$b3theme_options) { update_option('b3theme_options', array()); $b3theme_options = get_option('b3theme_options'); } add_action('admin_init', 'b3theme_admin_init'); } add_action('after_setup_theme', 'b3theme_setup'); if ( !isset( $content_width ) ) { $content_width = 970; } /* $content_width not really used currently in this theme but required by Wordpress theme autochecker. Content width is calculated and being set by Bootstrap. */ function b3theme_option($key) { global $b3theme_options; if (isset($b3theme_options[$key])) { return $b3theme_options[$key]; } return ''; } function b3theme_wp_nav_menu_args($args) { $args['container'] = false; return $args; } function b3theme_wp_page_menu($args) { $pages = get_pages(); foreach($pages as $key=>$page) { $pages[$key]->db_id = $page->ID; $pages[$key]->menu_item_parent = $page->post_parent; $pages[$key]->url = get_page_link($page->ID); } $pages = b3theme_wp_nav_menu_objects($pages); $out = ''; return $out; } add_filter('wp_nav_menu_objects', 'b3theme_wp_nav_menu_objects'); function b3theme_wp_nav_menu_objects ($menu_items) { foreach($menu_items as $key => $item) { $sort_num_of[$item->db_id] = $key; } foreach($menu_items as $key => $item) { if ($item->menu_item_parent) { $menu_items[ $sort_num_of[$item->menu_item_parent] ]->has_children = 1; } } return $menu_items; } class Tb3theme_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $has_children = empty($item->has_children) ? false : true; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; if($has_children) { if ($depth ) { $classes[] = 'dropdown-submenu'; } else { $classes[] = 'dropdown'; } } $classes[] = 'depth-'.$depth; if (!is_object($args)) { $args = (object)array_merge(array('link_before' => '', 'link_after' => '', 'before' => '', 'after' => ''), $args); } $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= 'has_children) ? ' class="dropdown-toggle" data-toggle="dropdown"' :'') . '>'; $item_output .= $args->link_before . apply_filters('the_title', !empty($item->post_title) ? $item->post_title : $item->title, $item->ID) . $args->link_after; $item_output .= (!empty($item->has_children) && !$depth) ? ' ' :''; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } function b3theme_widgets_init() { if ('Y' == b3theme_option('panel_widget')) { $args= array( 'before_widget' => '', 'before_title' => '', 'after_title' => '', // see b3theme_panel_widget_title() ); } else { $args= array( 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ); } $args['name'] = __('Sidebar 1', 'b3theme'); $args['id'] = 'sidebar-1'; register_sidebar($args); register_sidebar(array( 'name' => __('Top Sidebar', 'b3theme'), 'id' => 'sidebar-top', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __('Bottom Sidebar', 'b3theme'), 'id' => 'sidebar-bottom', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'b3theme_widgets_init'); function b3theme_panel_widget_title($title) { if ('Y' == b3theme_option('panel_widget')) { if (!$title) { $title = ' '; } $out = '

' . $title . '

'; } else { $out = $title ? '

' . $title . '

' : $title; } return $out; } function b3theme_enqueue_scripts() { global $wp_scripts; wp_enqueue_script('bootstrap', apply_filters('b3theme_bootstrap_js', B3THEME_URI . '/bootstrap/js/bootstrap.min.js'), array('jquery'), null, true); // apply_filters - a way to implement bootstrap CDN by plugins. wp_enqueue_script('b3theme', B3THEME_URI . '/js/b3theme.js', array('jquery'), null, true); if ( is_singular() && comments_open() && get_option('thread_comments') ) { wp_enqueue_script('comment-reply'); } if (is_singular() && wp_attachment_is_image()) { wp_enqueue_script('b3theme-keyboard-image-navigation', B3THEME_URI . '/js/keyboard-image-navigation.js', array('jquery'), '20120202'); } } add_action('wp_enqueue_scripts', 'b3theme_enqueue_scripts'); function b3theme_enqueue_styles() { wp_enqueue_style('bootstrap', apply_filters('b3theme_bootstrap_css', B3THEME_URI . '/bootstrap/css/bootstrap.min.css')); wp_enqueue_style('b3theme-style', B3THEME_URI . '/style.css'); wp_add_inline_style('b3theme-style', b3theme_options_css()); } add_action('wp_enqueue_scripts', 'b3theme_enqueue_styles'); function b3theme_admin_enqueue_scripts() { global $pagenow; if ('themes.php' == $pagenow) { wp_enqueue_script('b3theme-admin', B3THEME_URI . '/js/b3theme-admin.js', array('wp-color-picker'), null, true); wp_localize_script('b3theme-admin', 'b3theme_admin', b3theme_admin_localize()); wp_enqueue_script('quicktags', '', array('jquery')); wp_enqueue_media(); wp_enqueue_style('b3theme-admin', B3THEME_URI . '/css/b3theme-admin.css'); wp_enqueue_style('wp-color-picker'); wp_enqueue_style('quicktags', includes_url('css/editor.min.css')); } } add_action('admin_enqueue_scripts', 'b3theme_admin_enqueue_scripts'); function b3theme_options_css() { $out = ''; if ('left' == b3theme_option('sidebar_main')) { $out .= '#secondary {float: left;} #primary {float: right;} '; } if (($css = b3theme_option('text_color')) && $css != '#333333') { $out .= 'body {color:'. $css . ';} '; $out .= '.entry-meta {color:'. b3theme_option('text_color2') . ';} '; } if ($css = b3theme_option('headers_color')) { $out .= 'h1,h2,h3,h4,h5,h6 {color:'. $css . ';} '; } if ($css = b3theme_option('link_color')) { $out .= 'a, a:visited {color:'. $css . ';} '; } if ($css = b3theme_option('link_hover_color')) { $out .= 'a:hover {color:'. $css . ';} '; } if (($css = b3theme_option('navbar_color')) && '#F8F8F8' != $css) { $color2 = b3theme_option('navbar_color2'); $g = 'linear-gradient(top, ' . $css . ', '. $color2 .')'; $gg = 'linear-gradient(to bottom, ' . $css . ', '. $color2 .')'; $out .= '.navbar-b3theme {background-color: '. $css . '; background-image: -webkit-' . $g . '; background-image: -ms-' . $g . '; background-image: ' . $gg .'; border: ' . b3theme_option('navbar_border') .' solid 1px;}'; } if (($css = b3theme_option('navbar_link_color')) && '#777777' != $css) { $out .= '.navbar-nav > li > a, .navbar-nav > li > a:visited, a.navbar-brand {color:'. $css . ' !important;} '; $out .= '.navbar-nav > li > a:hover, a.navbar-brand:hover {color:'. b3theme_option('navbar_link_color2') . ' !important;} '; } return $out; } function b3theme_comment_form_before() { echo '
'; } function b3theme_comment_form_after() { echo '
'; } function b3theme_post_class($classes) { if ( 'Y'==b3theme_option('panel_post') || in_array('sticky', $classes) ) { $classes[]= 'panel-body'; } $classes[]= 'clearfix'; return $classes; } function b3theme_content_wrap_class() { $classes = array(); if ('Y'==b3theme_option('panel_post') || is_sticky() ) { $classes[]= 'panel'; } if ($classes) { echo 'class="' . implode(' ', $classes) . '"'; } } add_filter('post_class', 'b3theme_post_class'); add_action('comment_form_before', 'b3theme_comment_form_before'); add_action('comment_form_after', 'b3theme_comment_form_after'); function b3theme_carousel() { $case = b3theme_option('carousel'); if ('N' == $case) { return; } else { if ('Y' == $case) { $slides = b3theme_option('slides'); } else { include B3THEME_PATH . '/inc/demo-slides.php'; } if ( $total = count($slides) ) { ?> 1) { ?>
'; printf( __('You have no slides yet. You can add your slides or activate demo slides. The optimum image width/height ratio is %2$s, the best image size: %3$s.', 'b3theme'), admin_url('themes.php?page=b3theme_settings'), '17:5', '1140 × 300 pixel'); echo ''; } } } require B3THEME_PATH . '/inc/template-tags.php'; require B3THEME_PATH . '/inc/extras.php'; require B3THEME_PATH . '/inc/customizer.php'; require B3THEME_PATH . '/inc/jetpack.php'; function b3theme_footer_script() { if ('Y' == b3theme_option('image_rounded')) { ?> __('All theme settings will be replaced by default dettings. Continue?', 'b3theme'), 'upload' => __('Theme settings will be replaced by settings from the uploaded file. Continue?', 'b3theme'), 'slide_remove' => __('This slide will be removed. Continue?', 'b3theme'), 'slide' => __('Slide', 'b3theme'), 'link' => __('Link', 'b3theme'), 'image_url' => __('Image URL', 'b3theme'), 'description' => __('Description', 'b3theme'), 'title' => __('Title', 'b3theme'), 'alt_text' => __('Alt text', 'b3theme'), 'choose' => __('Choose', 'b3theme'), 'choose_image' => __('Choose Image', 'b3theme'), 'specify_slide_url' => __('Please specify image URL for each slide or remove unnecessary slides.', 'b3theme'), ); return $out; } function b3theme_ie_conditional() { ?>