__( 'Primary Menu', 'bluesip' ), ) ); } endif; // bluesip_setup add_action( 'after_setup_theme', 'bluesip_setup' ); /** * Enqueue scripts and styles */ function bluesip_scripts() { wp_enqueue_style( 'style', get_stylesheet_uri() ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20120206', true ); if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'bluesip_scripts' ); /** * Format in head of document * * @since bluesip 1.0 */ function bluesip_wp_title( $mytitle, $separated ) { global $paged, $page; if ( is_feed() ) return $mytitle; // Get site name. $mytitle .= get_bloginfo( 'name' ); // Format home or front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $mytitle = "$mytitle $separated $site_description"; // Add a page number. if ( $paged >= 2 || $page >= 2 ) $mytitle = "$mytitle $separated " . sprintf( __( 'Page %s', 'bluesip' ), max( $paged, $page ) ); return $mytitle; } add_filter( 'wp_title', 'bluesip_wp_title', 10, 2 ); if ( ! function_exists( 'bluesip_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. * * @since bluesip 1.0 */ function bluesip_posted_on() { printf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'bluesip' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'bluesip' ), get_the_author() ) ), esc_html( get_the_author() ) ); } endif; if ( ! function_exists( 'bluesip_date_posts' ) ) : /** * Prints HTML for the current post-date in index * * See http://codex.wordpress.org/Formatting_Date_and_Time * * @since bluesip 1.0 */ function bluesip_date_posts() { printf( __('<div class="bluesip-date"><div class="bluesip-show-day">%1$s</div><div class="bluesip-show-month">%2$s</div></div>', 'bluesip'), esc_html( get_the_date( 'j' ) ), esc_html( get_the_date( 'M' ) ) ); } endif; if ( ! function_exists( 'bluesip_show_avatar' ) ) : /** * Show the Avatar of Author for the current post * * See http://codex.wordpress.org/Function_Reference/get_avatar * * @since bluesip 1.0 */ function bluesip_show_avatar() { printf( __('<div class="bluesip-avatar">%1$s</div><div class="arrow"></div>', 'bluesip'), get_avatar( get_the_author_meta( 'ID' ), 64 ) ); } endif; if ( ! function_exists( 'bluesip_posted_author' ) ) : /** * Prints HTML with meta information for author in index posts. * * @since bluesip 1.0 */ function bluesip_posted_author() { printf( __( 'Posted by <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', 'bluesip' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'bluesip' ), get_the_author() ) ), esc_html( get_the_author() ) ); } endif; /** * Returns true if a blog has more than 1 category * * @since Shape 1.0 */ function bluesip_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // With more than 1 category return true; } else { // if this blog has only 1 category return false; } } /** * Flush out the transients used in bluesip_categorized_blog * * @since bluesip 1.0 */ function bluesip_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'bluesip_category_transient_flusher' ); add_action( 'save_post', 'bluesip_category_transient_flusher' ); /** * Register widgetized area and update sidebar with default widgets * * @since bluesip 1.0 */ function bluesip_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Widget Area', 'bluesip' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="left-arrow-widget"></div><h3 class="widget-title">', 'after_title' => '</h3><div class="right-arrow-widget"></div>', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 1', 'bluesip' ), 'id' => 'sidebar-footer-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="left-arrow-widget"></div><h3 class="widget-title">', 'after_title' => '</h3><div class="right-arrow-widget"></div>', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 2', 'bluesip' ), 'id' => 'sidebar-footer-2', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="left-arrow-widget"></div><h3 class="widget-title">', 'after_title' => '</h3><div class="right-arrow-widget"></div>', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 3', 'bluesip' ), 'id' => 'sidebar-footer-3', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="left-arrow-widget"></div><h3 class="widget-title">', 'after_title' => '</h3><div class="right-arrow-widget"></div>', ) ); } add_action( 'widgets_init', 'bluesip_widgets_init' ); function bluesip_admin() { // add the Customize link to the admin menu add_theme_page( 'Customize', 'Customize', 'edit_theme_options', 'customize.php' ); } add_action ('admin_menu', 'bluesip_admin'); /** * Setup the WordPress core custom background feature. * * Use add_theme_support to register support for WordPress 3.4+ * as well as provide backward compatibility for previous versions. * Use feature detection of wp_get_theme() which was introduced * in WordPress 3.4. * * Hooks into the after_setup_theme action. * */ function bluesip_register_custom_background() { $args = array( 'default-color' => 'ffffff', ); $args = apply_filters( 'bluesip_custom_background_args', $args ); if ( function_exists( 'wp_get_theme' ) ) { add_theme_support( 'custom-background', $args ); } else { define( 'BACKGROUND_COLOR', $args['default-color'] ); define( 'BACKGROUND_IMAGE', $args['default-image'] ); add_theme_support(); } } add_action( 'after_setup_theme', 'bluesip_register_custom_background' );