__( '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( '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' ); /** * CSS init */ if ( ! function_exists( 'blaskan_css_init' ) ): function blaskan_css_init() { if ( !is_admin() ) { wp_enqueue_style( 'blaskan-framework', get_template_directory_uri() . '/framework.css', array(), false, 'screen' ); wp_enqueue_style( 'blaskan-style', get_template_directory_uri() . '/style.css', array(), false, 'screen' ); wp_enqueue_style( 'blaskan-handheld', get_template_directory_uri() . '/css/handheld.css', array(), false, 'handheld' ); } } 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 */ function blaskan_head_cleanup() { remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wlwmanifest_link' ); remove_action( 'wp_head', 'wp_generator' ); } add_action( 'init' , 'blaskan_head_cleanup' ); /** * Format the title */ if ( ! function_exists( 'blaskan_head_title' ) ): function blaskan_head_title() { global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'blaskan' ), max( $paged, $page ) ); } endif; /** * Add content to wp_head() */ if ( ! function_exists( 'blaskan_head' ) ): function blaskan_head() { echo ''."\r"; echo ''."\r"; echo ''."\r"; 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() { // Unit PNG fix for IE 7 echo ''."\r"; // 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 */ 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' ) ); } 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/ */ function blaskan_root_relative_permalinks($input) { return preg_replace('!http(s)?://' . $_SERVER['SERVER_NAME'] . '/!', '/', $input); } add_filter( 'the_permalink', 'blaskan_root_relative_permalinks' ); /** * Remove empty span * Credits: http://nicolasgallagher.com/anatomy-of-an-html5-wordpress-theme/ */ function blaskan_remove_empty_read_more_span($content) { return eregi_replace( "(

)", "", $content ); } 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 */ 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; } add_filter('the_content_more_link', 'blaskan_remove_more_jump_link'); /** * Use
and
in captions * Credits: http://wpengineer.com/917/filter-caption-shortcode-in-wordpress/ */ if ( ! function_exists( 'blaskan_caption' ) ): function blaskan_caption($attr, $content = null) { // Allow plugins/themes to override the default caption template. $output = apply_filters( 'img_caption_shortcode', '', $attr, $content ); if ( $output != '' ) return $output; extract( shortcode_atts ( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr ) ); if ( 1 > (int) $width || empty( $caption ) ) return $content; if ( $id ) $id = 'id="' . $id . '" '; return '
' . do_shortcode( $content ) . '
' . $caption . '
'; } endif; add_shortcode( 'wp_caption', 'blaskan_caption' ); add_shortcode( 'caption', 'blaskan_caption' ); 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;