__( 'Primary Navigation', 'brunelleschi' ), ) ); /* Default Header Stuff */ if ( ! defined( 'HEADER_TEXTCOLOR' ) ) { define( 'HEADER_TEXTCOLOR', '' ); } if ( ! defined( 'NO_HEADER_TEXT' ) ) { define( 'NO_HEADER_TEXT', true ); } } endif; /*---------------------------------------- # # REGISTER ASSETS # ----------------------------------------*/ if( ! function_exists( 'brunelleschi_register_assets') ): function brunelleschi_register_assets(){ /*---------------------------------------- # # REGISTER SCRIPTS # ----------------------------------------*/ /* Modernizr */ wp_register_script('modernizr', get_template_directory_uri() . '/js/modernizr-2.5.2.min.js' ); if(!is_admin()) wp_enqueue_script('modernizr'); /* Contains Media Queries Used by 1140px Grid */ wp_register_script('respond', get_template_directory_uri() . '/js/respond.js', array()); if( !is_admin() ){ wp_enqueue_script('respond'); } /* Register jQuery */ if(!is_admin()) wp_enqueue_script('jquery'); /* Additional Scripts */ wp_register_script('brunelleschi-scripts', get_template_directory_uri() . '/js/brunelleschi-scripts.js', array()); if( !is_admin() ){ wp_enqueue_script('brunelleschi-scripts'); } if(brunelleschi_options('use-featured-content') == '1'){ /* Register Slider Scripts */ wp_register_script('slider', get_template_directory_uri() . '/js/jquery.flexslider-min.js' ); if(!is_admin()) wp_enqueue_script('slider'); /* Register Slider Styles */ wp_register_style('brunelleschi_flexslider', get_template_directory_uri() . '/inc/flexslider.css' ); if(!is_admin()) wp_enqueue_style('brunelleschi_flexslider'); wp_register_style('brunelleschi_featured_content', get_template_directory_uri() . '/inc/featured-content.css' ); if(!is_admin()) wp_enqueue_style('brunelleschi_featured_content'); } } endif; add_action('init','brunelleschi_register_assets'); /*---------------------------------------- # # SETUP FUNCTIONS # ----------------------------------------*/ /* Title Function */ if ( ! function_exists( 'brunelleschi_title' ) ): function brunelleschi_title(){ global $page, $paged; wp_title( '»', true, 'right' ); bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " » $site_description"; if ( $paged >= 2 || $page >= 2 ) echo ' » ' . sprintf( __( 'Page %s', 'brunelleschi' ), max( $paged, $page ) ); } endif; /* Posted In Function */ if ( ! function_exists( 'brunelleschi_posted_in' ) ): function brunelleschi_posted_in() { $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.', 'brunelleschi' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'brunelleschi' ); } else { $posted_in = __( 'Bookmark the permalink.', 'brunelleschi' ); } printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; /* Posted On Function */ if ( ! function_exists( 'brunelleschi_posted_on' ) ): function brunelleschi_posted_on() { printf( __('by %3$s Posted on %2$s', 'brunelleschi' ), 'meta-prep meta-prep-author', sprintf( '%3$s', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), sprintf( '%3$s', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'brunelleschi' ), get_the_author() ), get_the_author() ) ); edit_post_link( __( 'Edit', 'brunelleschi' ), ' [', ']' ); } endif; /* Theme Comments */ if ( ! function_exists( 'brunelleschi_comment' ) ): function brunelleschi_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    says:', 'brunelleschi' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • (.*?)#s", '', $css ); } endif; if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) { add_filter( 'gallery_style', 'brunelleschi_remove_gallery_css' ); } /* Custom Excerpt More */ if ( ! function_exists( 'brunelleschi_custom_excerpt_more' ) ): function brunelleschi_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= brunelleschi_continue_reading_link(); } return $output; } endif; add_filter( 'get_the_excerpt', 'brunelleschi_custom_excerpt_more' ); /* Show the Home Page */ if ( ! function_exists( 'brunelleschi_page_menu_args' ) ): function brunelleschi_page_menu_args( $args ) { $args['show_home'] = true; return $args; } endif; add_filter( 'wp_page_menu_args', 'brunelleschi_page_menu_args' ); /* Excerpt Length */ if ( ! function_exists( 'brunelleschi_excerpt_length' ) ): function brunelleschi_excerpt_length( $length ) { return 40; } endif; add_filter( 'excerpt_length', 'brunelleschi_excerpt_length' ); /* Continue Reading Link */ if ( ! function_exists( 'brunelleschi_continue_reading_link' ) ): function brunelleschi_continue_reading_link() { return ' ' . __( 'Continue reading ', 'brunelleschi' ) . ''; } endif; /* Auto Excerpt More */ if ( ! function_exists( 'brunelleschi_auto_excerpt_more' ) ): function brunelleschi_auto_excerpt_more( $more ) { return ' …' . brunelleschi_continue_reading_link(); } endif; add_filter( 'excerpt_more', 'brunelleschi_auto_excerpt_more' ); /* Admin Header Style */ if ( ! function_exists( 'brunelleschi_admin_header_style' ) ): function brunelleschi_admin_header_style() { ?> '444', 'default-image' => '', // Set height and width, with a maximum value for the width. 'height' => 198, 'width' => $content_width, 'max-width' => 2000, // Support flexible height and width. 'flex-height' => true, 'flex-width' => true, // Random image rotation off by default. 'random-default' => false, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'brunelleschi_header_style', // Header Text 'header-text' => true, //'admin-head-callback' => 'brunelleschi_admin_header_style', //'admin-preview-callback' => 'brunelleschi_admin_header_image', ); add_theme_support( 'custom-header', $args ); } /*---------------------------------------- # # REGISTER WIDGETS AND SIDEBARS # ----------------------------------------*/ if ( ! function_exists( 'brunelleschi_widgets_init' ) ): function brunelleschi_widgets_init( ) { if( brunelleschi_options('sidebar') !== __('none','brunelleschi') ){ /* Widget Area 1, located at the top of the sidebar.*/ register_sidebar( array( 'name' => __( 'Primary Widget Area', 'brunelleschi' ), 'id' => 'primary-widget-area', 'description' => __( 'The first widget area', 'brunelleschi' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); /* Widget Area 2, located below the Primary Widget Area in the sidebar. */ register_sidebar( array( 'name' => __( 'Secondary Widget Area', 'brunelleschi' ), 'id' => 'secondary-widget-area', 'description' => __( 'The second widget area', 'brunelleschi' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } if( brunelleschi_options('sidebar') === __('both','brunelleschi') || brunelleschi_options('sidebar') === __('two left','brunelleschi') || brunelleschi_options('sidebar') === __('two right','brunelleschi') ){ /* Widget Area 1, located at the top of the second sidebar.*/ register_sidebar( array( 'name' => __( 'Ternary Widget Area', 'brunelleschi' ), 'id' => 'ternary-widget-area', 'description' => __( 'The third widget area', 'brunelleschi' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); /* Widget Area 2, located below the Ternary Widget Area in the sidebar. */ register_sidebar( array( 'name' => __( 'Quaternary Widget Area', 'brunelleschi' ), 'id' => 'quaternary-widget-area', 'description' => __( 'The fourth widget area', 'brunelleschi' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

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

    ', 'after_title' => '

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

    ', 'after_title' => '

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

    ', 'after_title' => '

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

    ', 'after_title' => '

    ', ) ); } endif; add_action( 'widgets_init', 'brunelleschi_widgets_init' ); /* Brunelleschi Branding Class */ if ( ! function_exists( 'brunelleschi_branding_class' )) : function brunelleschi_branding_class($echo = true){ if( brunelleschi_options('header-order') === __('Text on the Left','brunelleschi') || brunelleschi_options('header-order') === __('Text on the Right','brunelleschi')){ if( brunelleschi_options('sidebar') === __('two left','brunelleschi') || brunelleschi_options('sidebar') === __('two right','brunelleschi')){ switch(brunelleschi_options('sidebar-width')){ case __('two','brunelleschi'): if($echo){ echo 'fourcol'; }else{ if(brunelleschi_options('header-order') === __('Text on the Right','brunelleschi')){ echo ' last '; } }; return 'four'; break; case __('three','brunelleschi'): if($echo){ echo 'sixcol'; }else{ if(brunelleschi_options('header-order') === __('Text on the Right','brunelleschi')){ echo ' last '; } }; return 'six'; break; case __('four','brunelleschi'): if($echo){ echo 'eightcol'; }else{ if(brunelleschi_options('header-order') === __('Text on the Right','brunelleschi')){ echo ' last '; } }; return 'eight'; break; } }elseif(brunelleschi_options('sidebar') === __('left','brunelleschi') || brunelleschi_options('sidebar') === __('right','brunelleschi')){ if($echo){ echo brunelleschi_options('sidebar-width').'col'; } return brunelleschi_options('sidebar-width'); }else{ if($echo){ echo 'threecol'; } return brunelleschi_options('sidebar-width'); } }else{ echo 'twelvecol last'; return 'twelve'; } if(brunelleschi_options('header-order') === __('Text on the Right','brunelleschi')){ echo ' last'; } } endif; /* Brunelleschi Banner Class */ if ( ! function_exists( 'brunelleschi_banner' )) : function brunelleschi_banner_class() { switch(brunelleschi_branding_class(false)){ case 'two': echo 'tencol '; break; case 'three': echo 'ninecol '; break; case 'four': echo 'eightcol '; break; case 'six': echo 'sixcol '; break; case 'eight': echo 'fourcol '; break; case 'twelve ': echo 'twelvecol '; break; } if(brunelleschi_options('header-order') !== __('Text on the Right','brunelleschi')){ echo 'last'; } } endif; /* Brunelleschi Sidebar Function */ if ( ! function_exists( 'brunelleschi_sidebar_class' ) ): function brunelleschi_sidebar_class(){ if(!brunelleschi_options('sidebar-width')){ echo 'threecol last '; } else { echo brunelleschi_options('sidebar-width').'col '; } if( brunelleschi_options('sidebar') === __('right','brunelleschi') || brunelleschi_options('sidebar') === __('both','brunelleschi') || brunelleschi_options('sidebar') === __('two right','brunelleschi')){ echo 'last '; } } endif; /* Brunelleschi Secondary Sidebar Function */ if ( ! function_exists( 'brunelleschi_secondary_sidebar_class' ) ): function brunelleschi_secondary_sidebar_class(){ if(!brunelleschi_options('sidebar-width')){ echo 'threecol'; } else { echo brunelleschi_options('sidebar-width').'col '; } if( brunelleschi_options('sidebar') === __('two right','brunelleschi')){ echo 'right'; }else{ echo 'left'; } } endif; /* Brunelleschi Content Function */ if ( ! function_exists( 'brunelleschi_content_class' ) ): function brunelleschi_content_class(){ if( !brunelleschi_options('sidebar') ) { echo 'ninecol '; } elseif( brunelleschi_options('sidebar') === __('none','brunelleschi') ) { echo 'twelvecol last '; } elseif( brunelleschi_options('sidebar') === __('both','brunelleschi') || brunelleschi_options('sidebar') === __('two left','brunelleschi') || brunelleschi_options('sidebar') === __('two right','brunelleschi') ){ switch( brunelleschi_options('sidebar-width') ) { case __('two','brunelleschi'): echo 'eightcol '; break; case __('three','brunelleschi'): echo 'sixcol '; break; case __('four','brunelleschi'): echo 'fourcol '; break; default: echo 'sixcol'; break; } } else { switch( brunelleschi_options('sidebar-width') ) { case __('two','brunelleschi'): echo 'tencol '; break; case __('three','brunelleschi'): echo 'ninecol '; break; case __('four','brunelleschi'): echo 'eightcol '; break; default: echo 'ninecol'; break; } } if( brunelleschi_options('sidebar') === __('left','brunelleschi') || brunelleschi_options('sidebar') === __('two left','brunelleschi') ) { echo ' last '; } if( brunelleschi_options('sidebar') === __('two left','brunelleschi')) { echo ' right '; } } endif; /* HTML5 Image Captions */ add_filter('img_caption_shortcode', 'brunelleschi_img_caption_shortcode_filter',10,3); if ( ! function_exists( 'brunelleschi_img_caption_shortcode_filter' ) ): function brunelleschi_img_caption_shortcode_filter($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; /* Experimental Featured Post*/ if ( ! function_exists( 'brunelleschi_slider_meta_box' ) ): function brunelleschi_slider_meta_box() { /* Define the custom box */ $prefix = 'brunelleschi_'; $meta_box = array( 'id' => 'featured-content-meta-box', 'title' => __('Featured Content','brunelleschi'), 'context' => 'side', 'priority' => 'default', 'fields' => array( array( 'name' => __('Add to Featured Content?','brunelleschi'), 'id' => $prefix . 'featured_post_checkbox', 'type' => 'checkbox' ), array( 'name' => __('Image Only','brunelleschi'), 'id' => $prefix . 'featured_post_image-only', 'type' => 'checkbox' ), array( 'name' => __('Display Text on Right or Left?','brunelleschi'), 'id' => $prefix . 'featured_post_position', 'type' => 'select', 'options' => array( __('left','brunelleschi'), __('right','brunelleschi') ), 'std' => __('left','brunelleschi') ), array( 'name' => __('Text Display Width?','brunelleschi'), 'id' => $prefix . 'featured_post_width', 'type' => 'select', 'options' => array( __('1/4 Width','brunelleschi'), __('1/3 Width','brunelleschi'), __('1/2 Width','brunelleschi'), __('Full Width','brunelleschi') ), 'std' => __('1/4 Width','brunelleschi') ), array( 'name' => __('Feature Description:','brunelleschi'), 'desc' => __('Add summary for the Feature Slider','brunelleschi'), 'id' => $prefix . 'featured_post_description', 'type' => 'textarea', 'std' => '' ) ) ); return $meta_box; } endif; /* Add meta box of option set */ if(brunelleschi_options('use-featured-content') == '1') { add_action('admin_menu', 'brunelleschi_add_meta_box'); } if ( ! function_exists( 'brunelleschi_add_meta_box' ) ): function brunelleschi_add_meta_box() { $meta_box = brunelleschi_slider_meta_box(); add_meta_box($meta_box['id'], $meta_box['title'], 'brunelleschi_show_meta_box', 'post', $meta_box['context'], $meta_box['priority']); add_meta_box($meta_box['id'], $meta_box['title'], 'brunelleschi_show_meta_box', 'page', $meta_box['context'], $meta_box['priority']); } endif; /* Callback function to show fields in meta box */ if ( ! function_exists( 'brunelleschi_show_meta_box' ) ): function brunelleschi_show_meta_box() { global $post; $meta_box = brunelleschi_slider_meta_box(); echo ''; echo ''; foreach ($meta_box['fields'] as $field) { $meta = get_post_meta($post->ID, $field['id'], true); echo ''; } echo '
    '; switch ($field['type']) { case 'checkbox': echo '', ''; break; case 'select': echo '', ''; break; case 'textarea': echo '', '', '
    ', $field['desc'], ''; break; } echo '
    '; } endif; add_action('save_post', 'brunelleschi_save_metabox_data'); /* Save data from meta box */ if ( ! function_exists( 'brunelleschi_save_metabox_data' ) ): function brunelleschi_save_metabox_data($post_id) { $meta_box = brunelleschi_slider_meta_box(); if (!wp_verify_nonce($_POST['brunelleschi_meta_box_nonce'], basename(__FILE__))) { return $post_id; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } elseif (!current_user_can('edit_post', $post_id)) { return $post_id; } foreach ($meta_box['fields'] as $field) { $old = get_post_meta($post_id, $field['id'], true); $new = $_POST[$field['id']]; if ($new && $new != $old) { /* Sanitize Textarea */ if($field['type'] === 'textarea'){ $new = addslashes($new); } update_post_meta($post_id, $field['id'], $new); } elseif ('' == $new && $old) { delete_post_meta($post_id, $field['id'], $old); } } } endif; /* Replaces anchor tags with spans to prevent nested links, essentially it creates fake links */ if ( ! function_exists( 'brunelleschi_featured_content_link_filter' )) : function brunelleschi_featured_content_link_filter($string){ $find = array( '//' ); $replace = array( '' ); $string = preg_replace ( $find , $replace , $string ); return $string; } endif;