esc_html__( 'Main Menu', 'biru' ), ) ); } endif; add_action( 'after_setup_theme', 'biru_setup' ); /*-----------------------------------------------------------------------------------*/ /* Set the content width based on the theme's design and stylesheet. /* ----------------------------------------------------------------------------------*/ function biru_content_width() { $GLOBALS['content_width'] = apply_filters( 'biru_content_width', 640 ); } add_action( 'after_setup_theme', 'biru_content_width', 0 ); /*-----------------------------------------------------------------------------------*/ /* Register widgetized area and update sidebars with default widgets. /* ----------------------------------------------------------------------------------*/ function biru_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'biru' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Right sidebar widgets here.', 'biru' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #1', 'biru' ), 'id' => 'sidebar-2', 'description' => esc_html__( 'Optional sub-footer widget area.', 'biru' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #2', 'biru' ), 'id' => 'sidebar-3', 'description' => esc_html__( 'Optional sub-footer widget area.', 'biru' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #3', 'biru' ), 'id' => 'sidebar-4', 'description' => esc_html__( 'Optional sub-footer widget area.', 'biru' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #4', 'biru' ), 'id' => 'sidebar-5', 'description' => esc_html__( 'Optional sub-footer widget area.', 'biru' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'biru_widgets_init' ); /*-----------------------------------------------------------------------------------*/ /* Count the number of footer sidebars to enable dynamic classes for the footer. /* ----------------------------------------------------------------------------------*/ function biru_subfooter_widget_class() { $count = 0; if ( is_active_sidebar( 'sidebar-2' ) ) $count++; if ( is_active_sidebar( 'sidebar-3' ) ) $count++; if ( is_active_sidebar( 'sidebar-4' ) ) $count++; if ( is_active_sidebar( 'sidebar-5' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'col-md-12'; break; case '2': $class = 'col-md-6'; break; case '3': $class = 'col-md-4'; break; case '4': $class = 'col-md-3'; break; } if ( $class ) echo 'class="' . $class . ' widget-area"'; } /*-----------------------------------------------------------------------------------*/ /* Add grid classes for the featured posts on the home page. /* ----------------------------------------------------------------------------------*/ function biru_featured_class( $class = '', $post_id = null ) { global $featured; if ( $class ) { $class .= ' '; } if ( $featured->current_post === 0 ) { $class .= 'active'; return post_class( $class, $post_id ); } else { return post_class( $class, $post_id ); } } /*-----------------------------------------------------------------------------------*/ /* Adds custom classes to the array of body classes. /* ----------------------------------------------------------------------------------*/ function biru_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } add_filter( 'body_class', 'biru_body_classes' ); /*-----------------------------------------------------------------------------------*/ /* Limit the excerpts characters. /* ----------------------------------------------------------------------------------*/ function biru_limit_string($string, $limit) { if (strlen($string) < $limit) return $string; $reg ="/^(.{1," . $limit . "}[^\s]*).*$/s"; return preg_replace($reg, '\\1', $string); } /*-----------------------------------------------------------------------------------*/ /* Display the protected posts password form. /* ----------------------------------------------------------------------------------*/ function biru_password_form ( $form ) { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $form = '

' . __( 'To view this protected post, enter the password below:', 'biru' ) . '

' . '
' . '
' . '' . '' . '
' . '' . '
'; return $form; } if ( !is_admin() ) { add_filter( 'the_password_form', 'biru_password_form' ); } /*-----------------------------------------------------------------------------------*/ /* Theme Options/Customizer. /* ----------------------------------------------------------------------------------*/ /* Get theme options. ---------------------------------------------------------------*/ function biru_get_option( $option_name, $default = '' ) { $options = get_option( 'biru_option' ); if( isset($options[$option_name]) ) { return $options[$option_name]; } return $default; } /* Display logo. --------------------------------------------------------------------*/ function biru_site_branding() { $header_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; $branding_logo = esc_url( biru_get_option( 'logo' ) ); $branding_display = ( biru_get_option( 'display', 'site_title' ) == 'site_title' ) ? 'display-title' : 'display-logo'; $branding_tagline = get_bloginfo( 'description' ); echo ''; } /* Display header social media icons. -----------------------------------------------*/ function biru_site_social() { $nwp_facebook = esc_url( biru_get_option( 'facebook' ) ); $nwp_twitter = esc_url( biru_get_option( 'twitter' ) ); $nwp_googleplus = esc_url( biru_get_option( 'googleplus' ) ); $nwp_tumblr = esc_url( biru_get_option( 'tumblr' ) ); $nwp_instagram = esc_url( biru_get_option( 'instagram' ) ); $nwp_youtube = esc_url( biru_get_option( 'youtube' ) ); $nwp_pinterest = esc_url( biru_get_option( 'pinterest' ) ); echo ''; } /* Display header search form. ------------------------------------------------------*/ function biru_site_search() { echo ''; } /*-----------------------------------------------------------------------------------*/ /* Returns the Google fonts stylesheet URL, if available. /* ----------------------------------------------------------------------------------*/ function biru_fonts_url() { $fonts_url = ''; /* Open Sans. -------------------------------------------------------------------*/ $font1 = _x( 'on', 'Open Sans font: on or off', 'biru' ); /* Quicksand. -------------------------------------------------------------------*/ $font2 = _x( 'on', 'Quicksand font: on or off', 'biru' ); if ( 'off' !== $font1 || 'off' !== $font2 ) { $font_families = array(); if ( 'off' !== $font1 ) $font_families[] = 'Open Sans:300,400,600,700,800,400italic,700italic'; if ( 'off' !== $font2 ) $font_families[] = 'Quicksand:300,400,700'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" ); } return $fonts_url; } /*-----------------------------------------------------------------------------------*/ /* Enqueue scripts and styles /* ----------------------------------------------------------------------------------*/ /* Enqueue scripts. -----------------------------------------------------------------*/ function biru_scripts() { wp_enqueue_script( 'biru-bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery' ), '', true ); wp_enqueue_script( 'biru-scripts', get_template_directory_uri() . '/assets/js/scripts.js', false, '1.0', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'biru_scripts' ); /* Enqueue styles. ------------------------------------------------------------------*/ function biru_styles() { wp_enqueue_style( 'biru-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' ); wp_enqueue_style( 'biru-icons', get_template_directory_uri() . '/assets/css/themify-icons.css' ); wp_enqueue_style( 'biru-fonts', biru_fonts_url() ); wp_enqueue_style( 'biru-style', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'biru_styles' ); /*-----------------------------------------------------------------------------------*/ /* Custom functions /* ----------------------------------------------------------------------------------*/ require_once get_template_directory() . '/includes/neowp-template-tags.php'; require_once get_template_directory() . '/includes/neowp-custom-widgets.php'; require_once get_template_directory() . '/includes/neowp-walker-comment.php'; require_once get_template_directory() . '/includes/neowp-walker-menu.php'; require_once get_template_directory() . '/includes/neowp-customizer.php';