'eeeeee' ) ); add_theme_support( 'custom-header', array( 'default-image' => BITLUMEN_THEME_URI . 'img/header/default.png', 'width' => 960, 'height' => 90, 'flex-height' => true, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'admin-preview-callback' => 'bitLumen_preview_header_cb' ) ); /* =HEADERS ------------------------------------------------------------------------- */ // custom header preview function bitLumen_preview_header_cb() { $textcolor = get_header_textcolor(); $h1 = ( $textcolor == 'blank' ? 'display:none;' : 'color:#' . $textcolor . ';' ); $h2 = ( bitLumen_get_option( 'blog_subtitle' ) ? $h1 : 'display:none;' ); $output = '

<' . get_bloginfo( 'name' ) . '

' . get_bloginfo( 'description' ) . '

'; echo $output; } // registers default custom header options function bitLumen_register_headers() { $headers = array ( 'blank-transparent' => array ( 'url' => BITLUMEN_THEME_URI . 'img/header/blank-transparent.png', 'thumbnail_url' => BITLUMEN_THEME_URI . 'img/header/blank-transparent-thumb.png', 'description' => 'Blank header image, transparent background' ), 'blank-eee' => array ( 'url' => BITLUMEN_THEME_URI . 'img/header/blank-eee.png', 'thumbnail_url' => BITLUMEN_THEME_URI . 'img/header/blank-eee-thumb.png', 'description' => 'Blank header image, light gray background' ), 'default' => array ( 'url' => BITLUMEN_THEME_URI . 'img/header/default.png', 'thumbnail_url' => BITLUMEN_THEME_URI . 'img/header/default-thumb.png', 'description' => 'Default header image, transparent background' ), 'icon-transparent' => array ( 'url' => BITLUMEN_THEME_URI . 'img/header/icon-transparent.png', 'thumbnail_url' => BITLUMEN_THEME_URI . 'img/header/icon-transparent-thumb.png', 'description' => 'Circle icon only, transparent background' ), 'icon-eee' => array ( 'url' => BITLUMEN_THEME_URI . 'img/header/icon-eee.png', 'thumbnail_url' => BITLUMEN_THEME_URI . 'img/header/icon-eee-thumb.png', 'description' => 'Circle icon only, light gray background' ) ); return register_default_headers( $headers ); } /* =HELPER FUNCTIONS ------------------------------------------------------------------------- */ // pluralize conditionally function bitLumen_plural( $count, $noun, $echo=true, $irregular_suffix=false ) { if( $count !== 1 ) $suffix = ( $irregular_suffix ? $irregular_suffix : 's' ); // special suffix else $suffix = ''; $output = $count . ' ' . $noun . $suffix; if( $echo ) echo $output; else return $output; } // get attachment data function bitLumen_get_attachment( $attachment_id='' ) { if( empty( $attachment_id ) ) $attachment_id = get_the_ID(); // use current id if none if( !wp_attachment_is_image( $attachment_id ) ) return false; // check if image $attachment = get_post( $attachment_id ); // get attachment if( !$attachment ) return false; else return array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'id' => $attachment->ID, 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'parent_id' => $attachment->post_parent, 'src' => $attachment->guid, 'title' => $attachment->post_title ); } // print settings error message function bitLumen_settings_message( $message ) { ?>

get_header_image(), 'height' => get_custom_header()->height, 'width' => get_custom_header()->width, 'text_color' => get_header_textcolor(), 'bg_color' => get_background_color() ); $css = urlencode( serialize( $args ) ); return wp_enqueue_style( 'bitLumen-dyn', BITLUMEN_THEME_URI . 'style.php?css=' . $css, 'bitLumen-core' ); } // bitLumen superfish integration function bitLumen_enqueue_nav_menu() { if( !is_admin() ) : wp_enqueue_style( 'bitLumen-nav', BITLUMEN_THEME_URI . 'lib/superfish/css/superfish.css', false, '1.4.8' ); wp_enqueue_script( 'bitLumen-nav', BITLUMEN_THEME_URI . 'lib/superfish/js/superfish.js', false, '1.4.8' ); endif; } /* =NAVIGATION ------------------------------------------------------------------------- */ // index page next/previous posts links function bitLumen_index_nav( $older_text='« Older posts', $newer_text='Newer posts »' ) { $older = get_next_posts_link( $older_text ); $newer = get_previous_posts_link( $newer_text ); $output = ''; if( !empty( $older ) ) $output .= '
' . $older . '
'; if( !empty( $newer ) ) $output .= '
' . $newer . '
'; if( !empty( $output ) ) { $output = '
' . $output . '
'; echo $output; } } // registers nav menu locations function bitLumen_register_nav_menus() { $nav_menus = array( 'primary-menu' => 'Primary navigation menu' ); register_nav_menus( $nav_menus ); } // prints a nav menu function bitLumen_nav_menu( $menu_id = 'primary-menu' ) { $nav_menus = array( 'primary-menu' => array( 'theme_location' => 'primary-menu', 'menu' => '', 'container_id' => 'navwrap', 'menu_class' => 'sf-menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '', 'depth' => 0, 'walker' => '' ) ); if( !isset( $nav_menus[$menu_id] ) ) return false; else wp_nav_menu( $nav_menus[$menu_id] ); } /* =SIDEBAR ------------------------------------------------------------------------- */ // registers sidebar locations function bitLumen_register_sidebars() { $sidebars = array( 'primary-sidebar' => array( 'name' => 'Primary Sidebar', 'id' => 'primary-sidebar', 'description' => 'The primary sidebar', 'class' => '', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' ) ); register_sidebar( $sidebars['primary-sidebar'] ); } // print default sidebar function bitLumen_default_sidebar() { require_once( BITLUMEN_THEME_DIR . 'lib/bitacre/bitacreDefaultWidgets.php' ); $bitLumenWidgets = new bitacreDefaultWidgets(); $version = $bitLumenWidgets->version; $bitLumenWidgets->addMeta(); $bitLumenWidgets->addRecentComments(); $bitLumenWidgets->addCategories( 'Categories', 1, 0, 1 ); $bitLumenWidgets->addTagCloud(); $bitLumenWidgets->addText( 'BitLumen Theme', '

    The bitLumen theme!

    ', 'bitLumen_default_text_widget_filter' ); } // default text widget text function bitLumen_default_text_widget_filter( $text ) { $admin = '

    Hi there Administrator! Thanks for adding the bitLumen theme!

    You will probably want to add some custom widgets and to get rid of the default ones. You should also checkout the theme options for some extra special settings.

    '; $normal = '

    The bitLumen theme!

    '; if( current_user_can( 'manage_options' ) ) $admin; else return $normal; } /* =FILTERS ------------------------------------------------------------------------- */ // wp_title filter function bitLumen_title_filter( $title, $sep, $seplocation ) { $ssep = ' ' . $sep . ' '; $pre = $num = ''; if( !is_single() ) { if( is_category() ) $pre = $ssep . 'Category'; elseif( is_tag() ) $pre = $ssep . 'Tag'; elseif( is_author() ) $pre = $ssep . 'Author'; elseif( is_year() || is_month() || is_day() ) $pre = $ssep . 'Archives'; } // get the page number (index format) if( get_query_var( 'paged' ) ) $num = $ssep . get_query_var( 'paged' ); // get the page number (multipage post format) elseif( get_query_var( 'page' ) ) $num = $ssep . get_query_var( 'page' ); // concoct and return title return get_bloginfo( 'name' ) . $pre . $title . $num; } // wp_foot filter function bitLumen_footer_filter() { $items = array( 'Powered by WordPress', 'bitLumen theme', 'created by Shinra Web Holdings' ); $user_foot = bitLumen_get_option( 'extra_footer' ); if( !empty( $user_foot ) ) array_push( $items, bitLumen_get_option( 'extra_footer' ) ); // build footer links echo implode( bitLumen_get_option( 'footer_sep' ), $items ); } /* =TEMPLATE ------------------------------------------------------------------------- */ // safely print post title and link function bitLumen_post_title( $echo=true ) { $post_id = get_the_ID(); $permalink = get_permalink( $post_id ); $post_title = get_the_title( $post_id ); $post_title_clean = esc_attr( strip_tags( $post_title ) ); if( empty( $post_title_clean ) ) { $post_title_clean = 'this post'; $post_title = '(no title)'; } $output = sprintf( '%3$s', $permalink, $post_title_clean, $post_title ); if( $echo ) echo $output; else return $output; } // safely get (attachment) post title function bitLumen_attachment_title( $echo=true ) { $parent_title = get_the_title( $post->post_parent ); if( empty( $parent_title ) ) $parent_title = '(no title)'; $output = sprintf( 'From %4$s: %3$s', get_permalink( $post->post_parent ), get_permalink(), $parent_title, ( is_page( $post->post_parent ) ? 'Page' : 'Post' ), ( wp_attachment_is_image() ? 'image' : 'file' ) ); if( $echo ) echo $output; else return $output; } // selectively returns the chosen parts of the entry meta function bitLumen_entry_meta( $echo=true ) { $items = array( bitLumen_post_author(), bitLumen_post_date(), ( bitLumen_get_option( 'entry_edit_link' ) ? bitLumen_edit_post_link() : false ), ( bitLumen_get_option( 'entry_trash_link' ) ? bitLumen_trash_post_link() : false ) ); $items = array_filter( $items ); $output = implode( ' ' . bitLumen_get_option( 'entry_meta_sep' ) . ' ', $items ); echo $output; } // post author meta item function bitLumen_post_author() { if( bitLumen_get_option( 'entry_post_author' ) == 'none' ) return false; $author_id = get_the_author_meta( 'ID' ); $author_name = get_the_author(); $author_nicename = get_the_author_meta( 'user_nicename' ); $author_url = get_author_posts_url( $author_id, $author_nicename ); if( bitLumen_get_option( 'entry_post_author' ) == 'link' ) $output = ''; else $output = '' . $author_name . ''; return $output; } // post date function bitLumen_post_date() { if( bitLumen_get_option( 'entry_post_date' ) == 'none' ) return false; elseif( bitLumen_get_option( 'entry_post_date' ) == 'updated' ) { $date = get_the_modified_date(); $time = get_the_modified_time(); } else { $date = get_the_date(); $time = get_the_time(); } if( !bitLumen_get_option( 'entry_post_time' ) ) $time = ''; else $time = ' at ' . $time; $output = $date . $time; if( !empty( $output ) ) return '' . $output . ''; } // edit link function bitLumen_edit_post_link() { if( current_user_can( 'edit_posts' ) ) return 'Edit'; } // trash link function bitLumen_trash_post_link() { if( current_user_can( 'delete_posts' ) ) return 'Trash'; } // equivalent of get_comments_popup_link function bitLumen_get_comments_popup_link() { if( !comment_open() ) return 'Comments Off'; $num = get_comments_number(); if( $num == 0 ) $text = 'Leave a Comment'; elseif( $num > 1 ) $text = $num . ' Comments'; else $text = '1 Comment'; return '' . $text . ''; } // special index page type function bitLumen_special_index_type( $post ) { if( is_category( $post ) ) { // category $title = 'Category'; $item = single_cat_title( '', false ); $message = 'You are now browsing all items filed in the “' . $item . '” category.'; } elseif( is_tag( $post ) ) { // tag $title = 'Tag'; $item = single_tag_title( '', false ); $message = 'You are now browsing all items tagged with “' . $item . '”'; } elseif( is_author() ) { // author $title = 'Author'; $item = get_the_author(); $message = 'You are now browsing all items authored by “' . $item . '.”'; } elseif( is_month() || is_day() ) { // archives (month or day) $title = 'Archives'; $item = substr( single_month_title(', ', false ), 2 ); $message = 'You are now browsing the archives for items from “' . $item . '.”'; } elseif( is_year() ) { // archive (year) $title = 'Archives'; $item = get_the_date( 'Y'); $message = 'You are now browsing the archives for posts from the year “' . $item . '.”'; } elseif( is_search() ) { // search $title = 'Search'; $item = get_search_query(); $message= 'You are now browsing our search results for “' . $item . '.”'; } else return false; // print content ?>
  • Index

  • 'post-thumbnail' ) ); $thumb = bitLumen_get_attachment( $thumb_id ); if( !empty( $thumb['caption'] ) ) $caption = $thumb['caption']; elseif( !empty( $thumb['description'] ) ) $caption = $thumb['description']; elseif( !empty( $thumb['title'] ) ) $caption = $thumb['title']; else $caption = $post_title; printf( '
    %4$s

    %5$s

    ', $thumb_id, $permalink, $post_title, $thumb_html, $caption ); } // add custom avatar callback function bitLumen_custom_avatar_cb( $avatar_defaults ) { $theme_image = BITLUMEN_THEME_URI . 'img/avatar.png'; $avatar_defaults[$theme_image] = 'bitLumen Avatar'; return $avatar_defaults; } /* =SETTINGS ------------------------------------------------------------------------- */ // register theme options function bitLumen_register_options() { register_setting( BITLUMEN_OPTIONS_GROUP, BITLUMEN_OPTIONS_NAME, 'bitLumen_sanatize_input' ); } // validate/sanatize options input function bitLumen_sanatize_input( $input ) { $types = array(); $options = array(); $struct = bitLumen_options_struct(); $defaults = bitLumen_get_defaults(); // get option types & suboptions foreach( $struct as $bundle ) { if( array_key_exists( 'id', $bundle ) ) $types = array_merge( $types, array( $bundle['id'] => $bundle['type'] ) ); if( array_key_exists( 'options', $bundle ) ) $options = array_merge( $options, array( $bundle['id'] => $bundle['options'] ) ); } // check by type foreach( $input as $key => $value ) : // check boxes if( $types[$key] == 'checkbox' ) : $input[$key] = ( $value ? 1 : '' ); // text boxes elseif( $types[$key] == 'text' || $types[$key] == 'text-short' || $types[$key] == 'textarea' ) : $input[$key] = esc_attr( $value ); // radio / select boxes elseif( $types[$key] == 'radio' || $types[$key] == 'select' ) : if( !array_key_exists( $value, $options[$key] ) ) $input[$key] = $defaults[$key]; endif; endforeach; return $input; } // gets array of all theme options function bitLumen_get_options( $use_global=true ) { if( $use_global ) global $bitLumen_options; if( !isset( $bitLumen_options ) ) $bitLumen_options = get_option( BITLUMEN_OPTIONS_NAME ); if( !$bitLumen_options ) $bitLumen_options = bitLumen_get_defaults(); return $bitLumen_options; } // get an option value from the theme's options array function bitLumen_get_option( $option_slug, $use_global=true ) { if( $use_global ) global $bitLumen_options; if( !isset( $bitLumen_options ) ) $bitLumen_options = bitLumen_get_options(); if( !array_key_exists( $option_slug, $bitLumen_options ) ) return false; else return $bitLumen_options[$option_slug]; } // delete theme options function bitLumen_delete_options() { delete_option( BITLUMEN_OPTIONS_NAME ); } // adds theme options page function bitLumen_create_menu() { add_theme_page( 'bitLumen Theme Options', 'Theme Options', 'edit_theme_options', BITLUMEN_OPTIONS_NAME, 'bitLumen_do_options_page' ); } // draws options pageadd_action( 'wp_head', 'add_our_scripts',0); function bitLumen_do_options_page() { // check for special functions if( array_key_exists( 'special_action', $_POST ) ) : // reset options if( $_POST['special_action'] == 'reset' ) { bitLumen_delete_options(); bitLumen_settings_message( 'Theme settings restored to default state.' ); } endif; // echo updated message if( isset( $_REQUEST['settings-updated'] ) ) bitLumen_settings_message( 'Theme options successfully saved.' ); ?>

    BitLumen Theme Options

    ' . "\r\n\t" . ''; if( isset( $notice ) ) $notice = '

    ' . $notice . '

    '; else $notice = ''; if( $type != 'checkbox' ) $notice .= ''; endif; // endif proper option ?>


    type="text" value="" /> type="text" value="" />
    $suboption ) : ?>
    $bundle['default'] ) ); return $defaults; } // options structure function bitLumen_options_struct() { $output = array ( // POST INFORMATION array( 'type' => 'section', 'name' => 'Post Information', 'desc' => 'Set the post information shown at the top of each post' ), // show authors array( 'id' => 'entry_post_author', 'type' => 'radio', 'name' => 'Post Author', 'desc' => 'Display post author name or link', 'options' => array( 'none' => 'Don\'t display any author information', 'text' => 'Display name as text', 'link' => 'Display name as link to author page' ), 'default' => 'link' ), // show post date array( 'id' => 'entry_post_date', 'type' => 'radio', 'name' => 'Post date', 'desc' => 'Display the date when each post or page was last created/updated', 'options' => array( 'none' => 'Don\'t display any post date', 'created' => 'Display date post was first published', 'updated' => 'Display date post was last updated' ), 'default' => 'created' ), // additional post options fieldset array( 'type' => 'fieldset', 'name' => 'Additional Post Options', 'desc' => 'More settings for post meta information' ), // show post times array( 'id' => 'entry_post_time', 'type' => 'checkbox', 'name' => 'Include the time in post date', 'desc' => 'Display the date when each post or page was last created/updated', 'default' => '' ), // hide edit link array( 'id' => 'entry_edit_link', 'type' => 'checkbox', 'name' => 'Include "edit post" link for administrators', 'desc' => 'Show the edit post link to logged in admin users', 'default' => 1 ), // hide trash link array( 'id' => 'entry_trash_link', 'type' => 'checkbox', 'name' => 'Include "trash post" link for administrators', 'desc' => 'Show a trash post link to logged in admin users', 'type' => 'checkbox', 'default' => '' ), array( 'type' => 'close-fieldset' ), array( 'type' => 'close' ), // SITE TEXT array( 'type' => 'section', 'name' => 'Site text', 'desc' => 'Custom text used on your site' ), // header fieldset array( 'type' => 'fieldset', 'name' => 'Header', 'desc' => 'Text settings for the site header' ), // subtitle array( 'id' => 'blog_subtitle', 'type' => 'checkbox', 'name' => 'Show blog description under title in the header', 'desc' => 'Should the description be shown under the title in the header', 'notice' => 'This option is ignored if “Show header text with your image” is unchecked on the Header options page.', 'default' => 1 ), // close fieldset header array( 'type' => 'close-fieldset' ), // title separator array( 'id' => 'title_sep', 'type' => 'text-short', 'name' => 'Title Separator', 'desc' => 'The character used to seperate pieces of information in the title', 'default' => '»' ), array( 'id' => 'entry_meta_sep', 'type' => 'text-short', 'name' => 'Post Meta Separator', 'desc' => 'The character used to seperate text or links in the post information', 'default' => '|' ), array( 'id' => 'footer_sep', 'type' => 'text-short', 'name' => 'Footer Seperator', 'desc' => 'The character used to seperate strings of text or links in the footer.', 'default' => '|' ), array( 'id' => 'keep_reading_text', 'type' => 'text', 'name' => '“Continue Reading” Text', 'desc' => 'The text used for the “continue reading” link when using the <--more--> tag.', 'default' => 'Keep reading' ), array( 'type' => 'close' ) ); return $output; } // FILTERS add_filter( 'avatar_defaults', 'bitLumen_custom_avatar_cb', 10, 1 ); add_filter( 'wp_title', 'bitLumen_title_filter', 10, 3 ); // ACTIONS add_action( 'admin_enqueue_scripts', 'bitLumen_enqueue_admin' ); // admin style add_action( 'admin_init', 'bitLumen_register_options' ); // register theme settings add_action( 'admin_menu', 'bitLumen_create_menu' ); // add link add_action( 'after_setup_theme', 'bitLumen_register_nav_menus', 10 ); add_action( 'after_setup_theme', 'bitLumen_register_headers', 10 ); add_action( 'widgets_init', 'bitLumen_register_sidebars', 10 ); add_action( 'wp_enqueue_scripts', 'bitLumen_enqueue_nav_menu', 0 ); add_action( 'wp_enqueue_scripts', 'bitLumen_enqueue_core', 10 ); add_action( 'wp_enqueue_scripts', 'bitLumen_enqueue_dynamic', 10 ); add_action( 'wp_footer', 'bitLumen_footer_filter', 99999 ); ?>