true, 'flex-width' => true, 'height' => HEADER_IMAGE_HEIGHT, 'width' => HEADER_IMAGE_WIDTH, ); add_theme_support( 'custom-header', $custom_header_args ); } endif; add_action( 'after_setup_theme', 'blaskan_setup' ); /** * Setup widths */ if ( ! function_exists( 'blaskan_setup_widths' ) ): function blaskan_setup_widths() { if ( BLASKAN_SIDEBARS == 'one_sidebar') { set_post_thumbnail_size( 830, 9999, true ); if ( ! isset( $content_width ) ) $content_width = 830; } else { set_post_thumbnail_size( 540, 9999, true ); if ( ! isset( $content_width ) ) $content_width = 540; } if ( ( is_active_sidebar( 'primary-sidebar' ) && is_active_sidebar( 'secondary-sidebar' ) ) || ( is_active_sidebar( 'primary-page-sidebar' ) && is_active_sidebar( 'secondary-page-sidebar' ) ) || ( BLASKAN_SIDEBARS == 'one_sidebar' && ( is_active_sidebar( 'primary-sidebar' ) || is_active_sidebar( 'primary-page-sidebar' ) ) ) ) { define( 'HEADER_IMAGE_WIDTH', 1120 ); } elseif ( ( is_active_sidebar( 'primary-sidebar' ) || is_active_sidebar( 'secondary-sidebar' ) ) || ( is_active_sidebar( 'primary-page-sidebar' ) || is_active_sidebar( 'secondary-page-sidebar' ) ) || ( BLASKAN_SIDEBARS == 'one_sidebar' && ( !is_active_sidebar( 'primary-sidebar' ) || !is_active_sidebar( 'primary-page-sidebar' ) ) ) ) { define( 'HEADER_IMAGE_WIDTH', 830 ); } else { define( 'HEADER_IMAGE_WIDTH', 540 ); } } endif; add_action( 'after_setup_theme', 'blaskan_setup_widths', 0 ); /** * Register menus */ if ( ! function_exists( 'blaskan_register_nav_menus' ) ): function blaskan_register_nav_menus() { register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'blaskan' ), 'footer' => __( 'Footer Navigation', 'blaskan' ), ) ); } endif; add_action( 'after_setup_theme', 'blaskan_register_nav_menus' ); /** * JS init */ if ( ! function_exists( 'blaskan_js_init' ) ): function blaskan_js_init() { if ( !is_admin() ) { wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/js/libs/modernizr.min.js' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-fitvids', get_template_directory_uri() . '/js/libs/jquery.fitvids.js' ); wp_enqueue_script( 'mobile-boilerplate-helper', get_template_directory_uri() . '/js/mylibs/helper.js' ); wp_enqueue_script( 'blaskan', get_template_directory_uri() . '/js/script.js' ); wp_localize_script( 'blaskan', 'objectL10n', array( 'blaskan_navigation_title' => __( '- Navigation -', 'blaskan' ) ) ); } } endif; add_action( 'init', 'blaskan_js_init' ); /** * Load League Gothic typeface */ if ( ! function_exists( 'blaskan_font_face' ) ): function blaskan_font_face() { if ( BLASKAN_TYPEFACE_TITLE == 'default' ) { echo " "; } } endif; add_action( 'wp_head', 'blaskan_font_face', 1 ); /** * CSS init */ if ( ! function_exists( 'blaskan_css_init' ) ): function blaskan_css_init() { if ( !is_admin() && !in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-signup.php', 'wp-register.php' ) ) ) { wp_enqueue_style( 'blaskan-framework', get_template_directory_uri() . '/framework.css', array(), false, 'screen' ); wp_enqueue_style( 'blaskan-style', get_bloginfo('stylesheet_url'), array(), false, 'all' ); } } endif; add_action( 'init', 'blaskan_css_init' ); /** * Register widget areas. All are empty by default. */ if ( ! function_exists( 'blaskan_widgets_init' ) ): function blaskan_widgets_init() { // Primary sidebar register_sidebar( array( 'name' => __( 'Primary Widget Area', 'blaskan' ), 'id' => 'primary-sidebar', 'description' => __( 'The primary sidebar', 'blaskan' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( BLASKAN_SIDEBARS !== 'one_sidebar' ) { // Secondary sidebar register_sidebar( array( 'name' => __( 'Secondary Widget Area', 'blaskan' ), 'id' => 'secondary-sidebar', 'description' => __( 'The secondary sidebar', 'blaskan' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } if ( BLASKAN_CUSTOM_SIDEBARS_IN_PAGES === TRUE ) { // Primary page sidebar register_sidebar( array( 'name' => __( 'Primary Page Widget Area', 'blaskan' ), 'id' => 'primary-page-sidebar', 'description' => __( 'The primary page sidebar', 'blaskan' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } if ( BLASKAN_CUSTOM_SIDEBARS_IN_PAGES === TRUE && BLASKAN_SIDEBARS !== 'one_sidebar' ) { // Secondary page sidebar register_sidebar( array( 'name' => __( 'Secondary Page Widget Area', 'blaskan' ), 'id' => 'secondary-page-sidebar', 'description' => __( 'The secondary page sidebar', 'blaskan' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } // Footer widgets register_sidebar( array( 'name' => __( 'Footer Widget Area', 'blaskan' ), 'id' => 'footer-widget-area', 'description' => __( 'The footer widget area', 'blaskan' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } endif; add_action( 'widgets_init', 'blaskan_widgets_init' ); /** * Head clean up */ if ( ! function_exists( 'blaskan_head_cleanup' ) ): function blaskan_head_cleanup() { remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wlwmanifest_link' ); remove_action( 'wp_head', 'wp_generator' ); } endif; add_action( 'init' , 'blaskan_head_cleanup' ); /** * Add content to wp_head() */ if ( ! function_exists( 'blaskan_head' ) ): function blaskan_head() { echo ''."\r"; echo ''."\r"; echo ''."\r"; } endif; add_action( 'wp_head', 'blaskan_head' ); /** * Add body classes */ if ( ! function_exists( 'blaskan_body_class' ) ): function blaskan_body_class($classes) { if ( get_theme_mod( 'background_image' ) || get_theme_mod( 'background_color' ) ) { $classes[] = 'background-image'; if ( get_theme_mod( 'background_color' ) == 'FFFFFF' || get_theme_mod( 'background_color' ) == 'FFF' ) { $classes[] = 'background-white'; } } if ( get_theme_mod( 'header_image' ) ) { $classes[] = 'header-image'; } $nav = wp_nav_menu( array( 'theme_location' => 'primary', 'echo' => false, 'container' => false ) ); $nav_links = substr_count( $nav, ''.esc_attr( get_bloginfo( 'name', 'display' ) ).''; endif; if ( $blaskan_options['hide_site_title_header_message'] !== 1 ) { if ( is_front_page() ) { $header_element = 'h1'; } else { $header_element = 'div'; } $output .= '<'.$header_element.' id="site-name">'.get_bloginfo( 'name' ).''; $output .= blaskan_header_message( get_bloginfo( 'description' ) ); } $output .= blaskan_primary_nav(); return $output; } endif; /** * Checks if to display a header message */ if ( ! function_exists( 'blaskan_header_message' ) ): function blaskan_header_message( $description = '' ) { if ( strlen( BLASKAN_HEADER_MESSAGE ) > 1 ) { return '
' . nl2br( stripslashes( wp_filter_post_kses( BLASKAN_HEADER_MESSAGE ) ) ) . '
'; } elseif ( !empty( $description ) ) { return '
' . $description . '
'; } else { return false; } } endif; /** * Returns primary nav */ if ( ! function_exists( 'blaskan_primary_nav' ) ): function blaskan_primary_nav() { $nav = wp_nav_menu( array( 'theme_location' => 'primary', 'echo' => false, 'container' => false ) ); // Check nav for links if ( strpos( $nav, '' . $nav_prepend . $nav . $nav_append . ''; } else { return; } } endif; /** * Blaskan footer structure */ if ( ! function_exists( 'blaskan_footer_structure' ) ): function blaskan_footer_structure() { $output = ''; $output .= get_sidebar( 'footer' ); $output .= blaskan_footer_nav(); if ( blaskan_footer_message() || blaskan_footer_credits() ) : $output .= ''; endif; return $output; } endif; /** * Returns footer nav */ if ( ! function_exists( 'blaskan_footer_nav' ) ): function blaskan_footer_nav() { $nav = wp_nav_menu( array( 'theme_location' => 'footer', 'depth' => 1, 'fallback_cb' => false, 'echo' => false, 'container' => false ) ); // Check nav for links if ( strpos( $nav, '' . $nav . ''; } else { return; } } endif; /** * Add content to wp_footer() */ if ( ! function_exists( 'blaskan_footer' ) ): function blaskan_footer() { // MBP helper functions echo ' '; // Selectivizr and Respond.js echo ''."\r"; } endif; add_action( 'wp_footer', 'blaskan_footer' ); /** * Removes the default styles that are packaged with the Recent Comments widget. * Credits: http://wordpress.org/extend/themes/coraline */ if ( ! function_exists( 'blaskan_remove_recent_comments_style' ) ): function blaskan_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } endif; add_action( 'widgets_init', 'blaskan_remove_recent_comments_style' ); /** * Root relative permalinks * Credits: http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/ */ if ( ! function_exists( 'blaskan_root_relative_permalinks' ) ): function blaskan_root_relative_permalinks($input) { return preg_replace('!http(s)?://' . $_SERVER['SERVER_NAME'] . '/!', '/', $input); } endif; add_filter( 'the_permalink', 'blaskan_root_relative_permalinks' ); /** * Remove empty span * Credits: http://nicolasgallagher.com/anatomy-of-an-html5-wordpress-theme/ */ if ( ! function_exists( 'blaskan_remove_empty_read_more_span' ) ): function blaskan_remove_empty_read_more_span($content) { return eregi_replace( "(

)", "", $content ); } endif; add_filter( 'the_content', 'blaskan_remove_empty_read_more_span' ); /** * Remove more jump link * Credits: http://codex.wordpress.org/Customizing_the_Read_More#Link_Jumps_to_More_or_Top_of_Page */ if ( ! function_exists( 'blaskan_remove_more_jump_link' ) ): function blaskan_remove_more_jump_link($link) { $offset = strpos($link, '#more-'); if ($offset) { $end = strpos($link, '"',$offset); } if ($end) { $link = substr_replace($link, '', $offset, $end-$offset); } return $link; } endif; add_filter('the_content_more_link', 'blaskan_remove_more_jump_link'); /** * Use
and
in captions */ if ( ! function_exists( 'blaskan_caption' ) ): function blaskan_caption( $val, $attr, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'align' => '', 'width' => '', 'caption' => '' ) , $attr ) ); if ( 1 > (int) $width || empty( $caption ) ) return $val; $capid = ''; if ( $id ) { $id = esc_attr( $id ); $capid = 'id="figcaption_'. $id . '" '; $id = 'id="' . $id . '" aria-labelledby="figcaption_' . $id . '" '; } return '
' . do_shortcode( $content ) . '
' . $caption . '
'; } endif; add_filter( 'img_caption_shortcode', 'blaskan_caption', 10, 3 ); if ( ! function_exists( 'blaskan_comment' ) ) : function blaskan_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="comment-">
    user_id && !$comment->comment_author_url ): ?> comment_author; ?> %s', get_comment_author_link() ); ?>
    comment_approved == '0' ) : ?>

    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • ' . $avatar . '
  • '; } else { return; } } endif; /** * Checks if to display a footer message */ if ( ! function_exists( 'blaskan_footer_message' ) ): function blaskan_footer_message() { if ( strlen( BLASKAN_FOOTER_MESSAGE ) > 1 ) { return ''; } else { return false; } } endif; /** * Checks if to display footer credits */ if ( ! function_exists( 'blaskan_footer_credits' ) ): function blaskan_footer_credits() { if ( BLASKAN_SHOW_CREDITS ) { return ''; } else { return false; } } endif;