__( 'Logged Out Menu', 'brisk' ), 'logged_in' => __( 'Logged In Menu', 'brisk' ), ) ); // This theme allows users to set a custom background add_custom_background(); // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '000' ); // No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '%s/images/headers/tomato.jpg' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to brisk_header_image_width and brisk_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'brisk_header_image_width', 990 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'brisk_header_image_height', 180 ) ); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be 940 pixels wide by 198 pixels tall. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See brisk_admin_header_style(), below. add_custom_image_header( 'brisk_header_style', 'brisk_admin_header_style', 'brisk_admin_header_image' ); // ... and thus ends the changeable header business. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'tomato' => array( 'url' => '%s/images/headers/tomato.jpg', 'thumbnail_url' => '%s/images/headers/tomato-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Tomato', 'brisk' ) ), 'water-drops' => array( 'url' => '%s/images/headers/water-drops.jpg', 'thumbnail_url' => '%s/images/headers/water-drops-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Water drops', 'brisk' ) ), 'limestone-cave' => array( 'url' => '%s/images/headers/limestone-cave.jpg', 'thumbnail_url' => '%s/images/headers/limestone-cave-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Limestone cave', 'brisk' ) ), 'Cactii' => array( 'url' => '%s/images/headers/cactii.jpg', 'thumbnail_url' => '%s/images/headers/cactii-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Cactii', 'brisk' ) ) ) ); } endif; if ( ! function_exists( 'brisk_header_style' ) ) : /** * Styles the header image and text displayed on the blog * * @since Brisk 1.0 */ function brisk_header_style() { // If no custom options for text are set, let's bail // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value if ( HEADER_TEXTCOLOR == get_header_textcolor() ) return; // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * * Referenced via add_custom_image_header() in brisk_setup(). * * @since Brisk 1.0 */ function brisk_admin_header_style() { ?> Header admin panel. * * Referenced via add_custom_image_header() in brisk_setup(). * * @since Brisk 1.0 */ function brisk_admin_header_image() { ?>

onclick="return false;" href="">

>
' . __( 'Continue reading ', 'brisk' ) . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and brisk_continue_reading_link(). * * @since Brisk 1.0 * @return string An ellipsis */ function brisk_auto_excerpt_more( $more ) { return ' …' . brisk_continue_reading_link(); } add_filter( 'excerpt_more', 'brisk_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * @since Brisk 1.0 * @return string Excerpt with a pretty "Continue Reading" link */ function brisk_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= brisk_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'brisk_custom_excerpt_more' ); // Puts link in excerpts more tag function new_excerpt_more($more) { global $post; return ' Read the full article...'; } add_filter('excerpt_more', 'new_excerpt_more'); /** * Remove inline styles printed when the gallery shortcode is used. * * Galleries are styled by the theme in Brisk's style.css. * * @since Brisk 1.0 * @return string The gallery style filter, with the styles themselves removed. */ function brisk_remove_gallery_css( $css ) { return preg_replace( "##s", '', $css ); } add_filter( 'gallery_style', 'brisk_remove_gallery_css' ); if ( ! function_exists( 'brisk_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own brisk_comment(), and that function will be used instead. * * @since Brisk 1.0 */ function brisk_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    comment_approved == '0' ) : ?>
  • __( 'Primary Widget Area', 'brisk' ), 'id' => 'sidebar-1', 'description' => __( 'The primary widget area', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 2, located below the Primary Widget Area in the sidebar. Empty by default. register_sidebar( array( 'name' => __( 'Secondary Widget Area', 'brisk' ), 'id' => 'secondary-widget-area', 'description' => __( 'The secondary widget area appears in 3-column layouts', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 3, located above the primary and secondary sidebars in Content-Sidebar-Sidebar and Sidebar-Sidebar-Content layouts. Empty by default. register_sidebar( array( 'name' => __( 'Feature Widget Area', 'brisk' ), 'id' => 'feature-widget-area', 'description' => __( 'The feature widget above the sidebars in Content-Sidebar-Sidebar and Sidebar-Sidebar-Content layouts', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // widget area above the header image register_sidebar( array( 'name' => __( 'Header Widget Area Above Image', 'brisk' ), 'id' => 'header-widget-above', 'description' => __( 'CSS class header-widget-above', 'brisk' ), 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // widget area below the image register_sidebar( array( 'name' => __( 'Header Widget Area Below Image', 'brisk' ), 'id' => 'header-widget-below', 'description' => __( 'CSS class header-widget-below', 'brisk' ), 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Full width footer widget register_sidebar( array( 'name' => __( 'Full Width Footer Widget Area', 'brisk' ), 'id' => 'full-width-footer-widget-area', 'description' => __( 'Full Width Footer Widget', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 4, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'brisk' ), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 5, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'brisk' ), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 6, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'brisk' ), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 7, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', 'brisk' ), 'id' => 'fourth-footer-widget-area', 'description' => __( 'The fourth footer widget area', 'brisk' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } /** Register sidebars by running brisk_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'brisk_widgets_init' ); /** * Removes the default styles that are packaged with the Recent Comments widget. * * @since Brisk 1.0 */ function brisk_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', 'brisk_remove_recent_comments_style' ); if ( ! function_exists( 'brisk_posted_on' ) ) : /** * Prints HTML with meta information for the current post—date/time. * * @since Brisk 1.0 */ function brisk_posted_on() { printf( __( 'Posted on %2$s ', 'brisk' ), 'meta-prep meta-prep-author', sprintf( '%3$s', get_permalink(), esc_attr( get_the_time() ), get_the_date() ) ); } endif; if ( ! function_exists( 'brisk_posted_by' ) ) : /** * Prints HTML with meta information for the current author on multi-author blogs */ function brisk_posted_by() { if ( is_multi_author() && ! is_author() ) { printf( __( 'by ', 'brisk' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'brisk' ), get_the_author_meta( 'display_name' ) ) ), esc_attr( get_the_author_meta( 'display_name' ) ) ); } } endif; if ( ! function_exists( 'brisk_posted_in' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). * * @since Brisk 1.0 */ function brisk_posted_in() { // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list ) { $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'brisk' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'brisk' ); } else { $posted_in = __( 'Bookmark the permalink.', 'brisk' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; /** * Returns the Brisk options with defaults as fallback * * @since Brisk 1.0.2 */ function brisk_get_theme_options() { // delete_option( 'brisk_theme_options' ); $defaults = array( 'color_scheme' => 'blue', 'theme_layout' => 'content-sidebar-sidebar', 'use_top_ad_bar' => 1, 'top_ad_bar_text' => 'Advertise Here', 'top_ad_bar_link' => home_url(), 'top_ad_bar_window' => 1, 'menu_above_image' => 0, 'use_pagination' => 1, 'excerpt_word_count' => 25, 'excerpt_search' => 1, 'excerpt_archive' => 1, 'excerpt_category' => 1, 'rounded_corners' => 0, 'js_insert' => '', 'css_insert' => '' ); $options = get_option( 'brisk_theme_options', $defaults ); return $options; } /** * Sets the post excerpt length to 30 characters. * * @since Brisk 1.0 * @return int */ function brisk_excerpt_length( $length ) { $options = brisk_get_theme_options(); return $options['excerpt_word_count']; } add_filter( 'excerpt_length', 'brisk_excerpt_length', 99999 ); // Using Google will speed up your downloads in many cases function brisk_enqueue() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js'); wp_enqueue_script( 'jquery' ); } add_action('wp_enqueue_scripts', 'brisk_enqueue'); // this function added to coroline function brisk_get_current_layout( ) { $options = brisk_get_theme_options(); $current_layout = $options['theme_layout']; if( is_singular() ) { $page_layout = get_post_meta(get_the_ID(),'page_layout',true); if( ! empty( $page_layout ) ) { $current_layout = $page_layout; } } return $current_layout; } /** * Returns the current Brisk layout as selected in the theme options * * @since Brisk 1.0 */ function brisk_current_layout() { $current_layout = brisk_get_current_layout(); $two_columns = array( 'content-sidebar', 'sidebar-content' ); $three_columns = array( 'content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content' ); if ( in_array( $current_layout, $two_columns ) ) return 'two-column ' . $current_layout; elseif ( in_array( $current_layout, $three_columns ) ) return 'three-column ' . $current_layout; else return 'no-sidebars'; } /** * Adds brisk_current_layout() to the array of body classes * * @since Brisk 1.0 */ function brisk_body_class($classes) { $classes[] = brisk_current_layout(); return $classes; } add_filter( 'body_class', 'brisk_body_class' ); /** * Return array for our color schemes */ function brisk_color_schemes() { $color_schemes = array( 'light' => array( 'value' => 'light', 'label' => __( 'White', 'brisk' ) ), 'dark' => array( 'value' => 'dark', 'label' => __( 'Black', 'brisk' ) ), 'pink' => array( 'value' => 'pink', 'label' => __( 'Pink', 'brisk' ) ), 'blue' => array( 'value' => 'blue', 'label' => __( 'Blue', 'brisk' ) ), 'purple' => array( 'value' => 'purple', 'label' => __( 'Purple', 'brisk' ) ), 'red' => array( 'value' => 'red', 'label' => __( 'Red', 'brisk' ) ), 'brown' => array( 'value' => 'brown', 'label' => __( 'Brown', 'brisk' ) ), 'rounded' => array( 'value' => 'rounded', 'label' => __( 'Rounded', 'brisk' ) ) ); return $color_schemes; } /** * WP.com: Check the current color scheme and set the correct themecolors array */ $options = brisk_get_theme_options(); $color_scheme = 'light'; if ( isset( $options['color_scheme'] ) ) $color_scheme = $options['color_scheme']; /** * Adjust the content_width value based on layout option and current template. * * @since Brisk 1.0 * @param int content_width value */ function brisk_set_full_content_width() { global $content_width; $content_width = 770; /* 770 */ // Override for 3-column layouts $layout = brisk_current_layout(); if ( strstr( $layout, 'three-column' ) ) $content_width = 990; return $content_width; } // brisk_print_menu() is used in two places in header.php depending on location of the menu function brisk_print_menu( $menu_id ) { ?> array( 'value' => 'content-sidebar', 'label' => __( 'Content-Sidebar', 'brisk' ), ), 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __( 'Sidebar-Content', 'brisk' ) ), 'content-sidebar-sidebar' => array( 'value' => 'content-sidebar-sidebar', 'label' => __( 'Content-Sidebar-Sidebar', 'brisk' ) ), 'sidebar-sidebar-content' => array( 'value' => 'sidebar-sidebar-content', 'label' => __( 'Sidebar-Sidebar-Content', 'brisk' ) ), 'sidebar-content-sidebar' => array( 'value' => 'sidebar-content-sidebar', 'label' => __( 'Sidebar-Content-Sidebar', 'brisk' ) ), 'no-sidebars' => array( 'value' => 'no-sidebars', 'label' => __( 'Full Width (No Sidebars)', 'brisk' ) ), ); return $theme_layouts; } // wp pagination for catagories, archives and home function wp_corenavi() { global $wp_query, $wp_rewrite; $pages = ''; $max = $wp_query->max_num_pages; if (!$current = get_query_var('paged')) $current = 1; $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $a['total'] = $max; $a['current'] = $current; $total = 1; //1 - display the text "Page N of N", 0 - not display $a['mid_size'] = 1; //how many links to show on the left and right of the current $a['end_size'] = 2; //how many links to show in the beginning and end $a['prev_text'] = '« Previous'; //text of the "Previous page" link $a['next_text'] = 'Next »'; //text of the "Next page" link if ($max > 1) echo ''; } /* This function removes comments and minifies the file to one line. If you try to use this on javaScript files you will mangle some of them. */ function brisk_css_compress($buffer) { /* remove comments */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* remove tabs, spaces, newlines, etc. */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' ',), '', $buffer); $buffer = str_replace(array(" } ", "} ", " }", "; }",";}" ), '}', $buffer); $buffer = str_replace(array(" { ", "{ ", " {" ), '{', $buffer); $buffer = str_replace(array(" , ", ", ", " ," ), ',', $buffer); $buffer = str_replace( ': ', ':', $buffer); return $buffer; } // create the brisk_css table. Only called once from functions.php. // broken out into a single function for readability function brisk_create_css_table() { global $wpdb; $old_date = '1970-01-01 00:00:01'; $default_css = 'body{background:green;color:red }'; // to make errs obvious $table_name = $wpdb->prefix . 'brisk_css'; $wpdb->query( " CREATE TABLE $table_name ( name varchar(24), last_compress varchar(20), css mediumtext, UNIQUE KEY `name` (`name`) ) " ); // These are the only inserts. The table should never grow. // Need to drop this table and let it regenerate if colors are added or theme updated. // New color schemes should be added in the brisk_color_schemes() function $wpdb->query( "INSERT INTO $table_name VALUES( 'style', '$old_date', '$default_css' )" ); foreach ( brisk_color_schemes() as $the_color ) { $wpdb->query( "INSERT INTO $table_name VALUES ( '".$the_color['value']."', '$old_date', '$default_css' )" ); } // footer is used to store js to display in the footer $wpdb->query( "INSERT INTO $table_name VALUES( 'footer', '$old_date', '' )" ); } // gets the appropriate color scheme css or style.css function brisk_get_compressed_css( $the_color = 'style' ) { global $wpdb, $color_scheme; $table_name = $wpdb->prefix . 'brisk_css'; $buffer; $fname = get_stylesheet_directory(); if( $the_color == 'style' ) { $fname .= '/style.css'; } else { $fname .= '/colors/'.$the_color.'.css'; } // get style css $sql = "SELECT * FROM $table_name WHERE name = '$the_color'"; // this is null if the table does not exist. if( is_null( $the_row = $wpdb->get_row( $sql, ARRAY_A ) ) ) { brisk_create_css_table(); $the_row = $wpdb->get_row( $sql , ARRAY_A); } // $fname = get_stylesheet_directory().'/style.css'; if( ! file_exists( $fname ) ) { return; } // file modification time $file_change_date = date('Y-m-d H:i:s',filemtime( $fname )); $buffer = $the_row['css']; // if the file mod is newer than the mysql version if( 0 < strcmp( $file_change_date, $the_row['last_compress'] ) ) { $buffer = brisk_css_compress( implode( file( $fname ) ) ); $result = $wpdb->update( $table_name, array( 'last_compress' => date( 'Y-m-d H:i:s', time() ), 'css' => $buffer ), array( 'name' => $the_color ) ); } return $buffer; } function brisk_adjust_css() { $options = brisk_get_theme_options(); echo brisk_get_compressed_css( 'style' ); echo brisk_get_compressed_css( $options['color_scheme'] ); if( $options['rounded_corners'] ) { echo brisk_get_compressed_css( 'rounded' ); // adjust location of image directory for rounded_corners $trans = "{background-image:url('".get_stylesheet_directory_uri()."/images/trans.png')}"; // make the changes in the actual classes echo "\n.type-page$trans"; echo "\n.post$trans"; echo "\n.widget-container$trans"; echo "\n.form-allowed-tags$trans"; echo "\n.page-title$trans"; } if( isset( $options['css_insert'] ) && strlen( $options['css_insert'] ) ) { echo $options['css_insert']; } // this line keeps firefox from putting the ad bar behind the wp admin bar echo ".brisk-admin-bar-space{ width=px;}"; } ?>