require_once( get_template_directory() . '/core/init.php' ); /** * Load the theme options page if in admin mode */ if ( is_admin() ) { require_once( get_template_directory() . '/inc/theme-options.php' ); require_once( get_template_directory() . '/inc/page-design.php' ); } require_once( get_template_directory() . '/inc/glyphicons.php' ); require_once( get_template_directory() . '/inc/custom-header.php' ); add_filter( 'enlightenment_default_theme_options', 'enlightenment_filter_default_theme_options' ); function enlightenment_filter_default_theme_options( $options ) { $defaults = array( 'navbar_position' => 'fixed-top', 'navbar_background' => 'default', 'navbar_size' => 'large', 'shrink_navbar' => true, 'blog_header_text' => __( 'From The Blog', 'enlightenment' ), 'blog_header_description' => '', 'thumbnail_header_image' => false, 'thumbnails_crop_flag' => false, 'thumbnails_size' => 'large', 'post_meta' => array( 'author' => true, 'date' => true, 'category' => true, 'comments' => true, 'edit_link' => true, ), 'portfolio_meta' => array( 'author' => true, 'date' => true, 'project_type' => true, 'comments' => true, 'edit_link' => true, ), 'enable_lightbox' => true, 'lightbox_script' => 'colorbox', 'posts_nav_style' => 'infinite', 'posts_nav_labels' => 'older/newer', 'copyright_notice' => sprintf( __( '© %1$s %2$s', 'enlightenment' ), '%year%', '%sitename%' ), 'theme_credit_link' => true, 'author_credit_link' => false, 'wordpress_credit_link' => true, 'page_design' => 'boxed', 'custom_css' => '', 'link_color' => '#428bca', 'link_hover_color' => '#2a6496', 'brand_font_family' => 'Open Sans', 'brand_font_size' => 24, 'brand_font_style' => '300', 'brand_font_color' => '#555', 'brand_hover_color' => '#5e5e5e', 'menu_items_font_family' => 'Open Sans', 'menu_items_font_size' => 14, 'menu_items_font_style' => '400', 'menu_items_font_color' => '#555', 'menu_items_hover_color' => '#428bca', 'page_header_font_family' => 'Open Sans', 'page_header_font_size' => 40, 'page_header_font_style' => '300', 'page_header_font_color' => '#777', 'entry_title_font_family' => 'Open Sans', 'entry_title_font_size' => 32, 'entry_title_font_style' => '700', 'entry_title_font_color' => '#333', 'teaser_entry_title_font_family' => 'Open Sans', 'teaser_entry_title_font_size' => 20, 'teaser_entry_title_font_style' => '700', 'teaser_entry_title_font_color' => '#333', 'single_entry_title_font_family' => 'Open Sans', 'single_entry_title_font_size' => 36, 'single_entry_title_font_style' => '700', 'single_entry_title_font_color' => '#333', 'entry_title_hover_color' => '#428bca', 'entry_meta_font_family' => 'Open Sans', 'entry_meta_font_size' => 13, 'entry_meta_font_style' => '300', 'entry_meta_font_color' => '#999', 'entry_meta_link_color' => '#456', 'entry_meta_link_hover_color' => '#428bca', 'entry_content_font_family' => 'Open Sans', 'entry_content_font_size' => 16, 'entry_content_font_style' => '400', 'entry_content_font_color' => '#333', 'entry_summary_font_family' => 'Open Sans', 'entry_summary_font_size' => 14, 'entry_summary_font_style' => '400', 'entry_summary_font_color' => '#333', 'widget_title_font_family' => 'Open Sans', 'widget_title_font_size' => 24, 'widget_title_font_style' => '700', 'widget_title_font_color' => '#333', 'widget_content_font_family' => 'Open Sans', 'widget_content_font_size' => 14, 'widget_content_font_style' => '400', 'widget_content_font_color' => '#555', 'widget_link_color' => '#428bca', 'widget_link_hover_color' => '#2a6496', 'footer_text_font_family' => 'Open Sans', 'footer_text_font_size' => 14, 'footer_text_font_style' => '400', 'footer_text_font_color' => '#555', 'footer_link_color' => '#428bca', 'footer_link_hover_color' => '#2a6496', 'page_header_tag' => 'h1', 'single_page_header_tag' => 'div', 'entry_title_tag' => 'h2', 'teaser_entry_title_tag' => 'h2', 'single_entry_title_tag' => 'h1', 'comments_title_tag' => 'h2', 'widget_title_tag' => 'h3', ); return array_merge( $options, $defaults ); } add_action( 'after_setup_theme', 'enlightenment_setup_theme' ); function enlightenment_setup_theme() { enlightenment_set_content_width( 640 ); add_theme_support( 'enlightenment-web-fonts' ); add_theme_support( 'enlightenment-accessibility' ); add_theme_support( 'enlightenment-bootstrap', array( 'min_files' => true, 'navbar-position' => enlightenment_theme_option( 'navbar_position' ), 'navbar-background' => enlightenment_theme_option( 'navbar_background' ), ) ); add_theme_support( 'enlightenment-schema-markup' ); add_theme_support( 'enlightenment-logo', array( 'width' => 48, 'height' => 48, ) ); add_theme_support( 'enlightenment-menu-icons' ); add_theme_support( 'enlightenment-menu-descriptions' ); add_theme_support( 'enlightenment-custom-layouts', array( 'content-sidebar', 'sidebar-content', 'full-width', 'sidebar-content-sidebar' ) ); add_theme_support( 'enlightenment-grid-loop' ); add_theme_support( 'jetpack-portfolio' ); if( enlightenment_theme_option( 'enable_lightbox' ) ) add_theme_support( 'enlightenment-lightbox', array( 'script' => enlightenment_theme_option( 'lightbox_script' ) ) ); if( 'infinite' == enlightenment_theme_option( 'posts_nav_style' ) ) add_theme_support( 'enlightenment-infinite-scroll' ); elseif( 'ajax' == enlightenment_theme_option( 'posts_nav_style' ) ) add_theme_support( 'enlightenment-ajax-navigation' ); add_theme_support( 'enlightenment-theme-settings', array( 'option_name' => 'enlightenment_theme_options' ) ); add_theme_support( 'enlightenment-template-editor' ); add_theme_support( 'enlightenment-page-builder' ); add_theme_support( 'enlightenment-unlimited-sidebars' ); add_theme_support( 'enlightenment-custom-queries' ); add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) ); add_theme_support( 'enlightenment-breadcrumbs' ); add_theme_support( 'enlightenment-share-buttons' ); add_theme_support( 'custom-background' ); add_theme_support( 'custom-header', array( 'width' => 1440, 'height' => 960, 'default-text-color' => '777777', 'flex-width' => true, 'flex-height' => true, 'wp-head-callback' => 'enlightenment_header_style', 'admin-head-callback' => '', 'admin-preview-callback' => '' ) ); add_theme_support( 'post-thumbnails' ); if( enlightenment_theme_option( 'thumbnail_header_image' ) ) add_theme_support( 'enlightenment-post-thumbnail-header' ); $crop_flag = enlightenment_theme_option( 'thumbnails_crop_flag' ); add_image_size( 'enlightenment-blog-thumb', 640, $crop_flag ? 480 : 9999, $crop_flag ); add_image_size( 'enlightenment-teaser-thumb', 300, $crop_flag ? 225 : 9999, $crop_flag ); load_theme_textdomain( 'enlightenment', get_template_directory() . '/languages' ); } add_action( 'after_setup_theme', 'enlightenment_add_editor_style', 1000 ); function enlightenment_add_editor_style() { $editor_styles = array(); $editor_styles[-2] = get_template_directory_uri() . '/core/css/bootstrap.min.css'; $editor_styles[-1] = str_replace( ',', '%2C', enlightenment_web_fonts_style() ); $editor_styles[0] = 'editor-style.css'; add_editor_style( $editor_styles ); } add_filter( 'enlightenment_theme_custom_css', 'enlightenment_filter_theme_custom_css' ); function enlightenment_filter_theme_custom_css( $output ) { $output .= enlightenment_print_color_option( 'a', 'link_color', false ); $output .= enlightenment_print_color_option( 'a:hover', 'link_hover_color', false ); $output .= enlightenment_print_font_options( '.navbar a.navbar-brand', 'brand', false ); $output .= enlightenment_print_color_option( '.navbar .navbar-brand:hover, .navbar .navbar-brand:focus', 'brand_hover_color', false ); $output .= enlightenment_print_font_options( '.navbar .nav > li > a, .navbar-large .menu-item .menu-item-description', 'menu_items', false ); $output .= enlightenment_print_color_option( '.navbar .nav > li > a:hover, .navbar-large .menu-item a:hover .menu-item-description, .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar .nav li.dropdown.open > .dropdown-toggle .menu-item-description', 'menu_items_hover_color', false ); $output .= enlightenment_print_font_options( '.archive-title', 'page_header', false ); $output .= enlightenment_print_font_options( '.entry-title', 'entry_title', false ); $output .= enlightenment_print_font_options( '.entry-teaser .entry-title', 'teaser_entry_title', false ); $output .= enlightenment_print_font_options( '.single .entry-title, .page .entry-title', 'single_entry_title', false ); $output .= enlightenment_print_color_option( '.entry-title a:hover', 'entry_title_hover_color', false ); $output .= enlightenment_print_font_options( '.entry-meta', 'entry_meta', false ); $output .= enlightenment_print_color_option( '.entry-meta a', 'entry_meta_link_color', false ); $output .= enlightenment_print_color_option( '.entry-meta a:hover', 'entry_meta_link_hover_color', false ); $output .= enlightenment_print_font_options( '.entry-content', 'entry_content', false ); $output .= enlightenment_print_font_options( '.entry-summary', 'entry_summary', false ); $output .= enlightenment_print_font_options( '.widget-title', 'widget_title', false ); $output .= enlightenment_print_font_options( '.widget', 'widget_content', false ); $output .= enlightenment_print_color_option( '.widget a', 'widget_link_color', false ); $output .= enlightenment_print_color_option( '.widget a:hover', 'widget_link_hover_color', false ); $output .= enlightenment_print_font_options( '.site-footer', 'footer_text', false ); $output .= enlightenment_print_color_option( '.site-footer a', 'footer_link_color', false ); $output .= enlightenment_print_color_option( '.site-footer a:hover', 'footer_link_hover_color', false ); $output .= enlightenment_sanitize_custom_css( enlightenment_theme_option( 'custom_css' ) ); return $output; } add_action( 'after_setup_theme', 'enlightenment_remove_header_container', 999 ); function enlightenment_remove_header_container() { remove_action( 'init', 'enlightenment_add_header_container' ); } function enlightenment_open_entry_tag() { echo enlightenment_open_tag( 'div', 'entry' ); } add_action( 'enlightenment_before_entries_list', 'enlightenment_grid_add_entry_container', 8 ); function enlightenment_grid_add_entry_container() { if( is_singular() ) return; $grid = enlightenment_get_grid( enlightenment_current_grid() ); // if( 1 != $grid['content_columns'] ) { add_action( 'enlightenment_before_entry_header', 'enlightenment_open_entry_tag', 1 ); add_action( 'enlightenment_after_entry_footer', 'enlightenment_close_container', 999 ); // } } add_filter( 'enlightenment_current_layout', 'enlightenment_filter_grid_layout' ); function enlightenment_filter_grid_layout( $layout ) { if( is_singular() ) return $layout; $grid = enlightenment_get_grid( enlightenment_current_grid() ); if( 2 < $grid['content_columns'] ) return 'full-width'; return $layout; } add_filter( 'enlightenment_infinite_scroll_script_args', 'enlightenment_filter_infinite_scroll_script_args' ); function enlightenment_filter_infinite_scroll_script_args( $args ) { $grid = enlightenment_get_grid( enlightenment_current_grid() ); return $args; } add_action( 'wp', 'enlightenment_layout_hooks' ); function enlightenment_layout_hooks() { add_action( 'enlightenment_before_content', 'enlightenment_open_container', 997 ); add_action( 'enlightenment_before_content', 'enlightenment_open_content_sidebar_wrapper', 998 ); add_action( 'enlightenment_before_content', 'enlightenment_open_row', 999 ); add_action( 'enlightenment_content', 'enlightenment_open_content_wrapper', 9 ); add_action( 'enlightenment_content', 'enlightenment_close_container', 11 ); add_action( 'enlightenment_after_content', 'enlightenment_sidebar_alt', 11 ); add_action( 'enlightenment_after_content', 'get_sidebar', 11 ); add_action( 'enlightenment_after_content', 'enlightenment_close_container', 12 ); add_action( 'enlightenment_after_content', 'enlightenment_close_container', 13 ); add_action( 'enlightenment_after_content', 'enlightenment_close_container', 14 ); add_action( 'enlightenment_before_widgets', 'enlightenment_open_widgets_wrapper', 8 ); add_action( 'enlightenment_after_widgets', 'enlightenment_close_widgets_wrapper', 11 ); } function enlightenment_open_content_start() { echo enlightenment_open_tag( 'div', 'content-start', 'content-start' ); } function enlightenment_open_content_sidebar_wrapper() { echo enlightenment_open_tag( 'div', 'content-sidebar-wrapper' ); } function enlightenment_open_content_wrapper() { echo enlightenment_open_tag( 'div', 'content-wrapper' ); } function enlightenment_open_entry_content_column() { $layout = enlightenment_get_layout( enlightenment_current_layout() ); echo enlightenment_open_tag( 'div', $layout['content_class'] ); } function enlightenment_open_widgets_wrapper() { if( 'primary' == enlightenment_current_sidebar_name() ) { echo enlightenment_open_tag( 'div', 'widgets-wrapper' ); } } function enlightenment_close_widgets_wrapper() { if( 'primary' == enlightenment_current_sidebar_name() ) { enlightenment_close_container(); } } add_filter( 'enlightenment_author_posts_link_args', 'enlightenment_filter_author_posts_link_args' ); function enlightenment_filter_author_posts_link_args( $args ) { if( doing_action( 'enlightenment_entry_header' ) ) { $args['format'] = __( 'Posted by %s', 'enlightenment' ); } elseif( is_single() && doing_action( 'enlightenment_entry_footer' ) ) { $args['container'] = 'h4'; $args['format'] = __( 'Written by %s', 'enlightenment' ); } return $args; } add_filter( 'enlightenment_entry_date_args', 'enlightenment_filter_entry_date_args' ); function enlightenment_filter_entry_date_args( $args ) { $args['format'] = __( 'On %s', 'enlightenment' ); return $args; } add_filter( 'enlightenment_categories_list_args', 'enlightenment_filter_categories_list_args' ); function enlightenment_filter_categories_list_args( $args ) { $args['format'] = __( 'Filed under %s', 'enlightenment' ); return $args; } add_filter( 'enlightenment_tags_list_args', 'enlightenment_filter_tags_list_args' ); function enlightenment_filter_tags_list_args( $args ) { $args['sep'] = ' '; return $args; } add_filter( 'enlightenment_project_types_args', 'enlightenment_filter_project_types_args' ); function enlightenment_filter_project_types_args( $args ) { $args['format'] = __( 'Filed under %s', 'enlightenment' ); return $args; } add_filter( 'enlightenment_comments_link_args', 'enlightenment_filter_comments_link_args' ); function enlightenment_filter_comments_link_args( $args ) { $args['format']['zero'] = __( 'No Comments', 'enlightenment' ); return $args; } add_filter( 'enlightenment_edit_post_link_args', 'enlightenment_filter_edit_post_link_args' ); function enlightenment_filter_edit_post_link_args( $args ) { $args['format'] = __( 'Edit This', 'enlightenment' ); return $args; } add_filter( 'enlightenment_author_avatar_args', 'enlightenment_filter_author_avatar_args' ); function enlightenment_filter_author_avatar_args( $args ) { if( is_singular() ) { $args['avatar_size'] = 96; } return $args; } add_filter( 'enlightenment_entry_meta_args', 'enlightenment_filter_entry_meta_args' ); function enlightenment_filter_entry_meta_args( $args ) { if( is_singular() && doing_action( 'enlightenment_entry_footer' ) ) { $args['format'] = '
%8$s
%1$s %9$s
%4$s'; } elseif( is_singular( 'jetpack-portfolio' ) ) { $args['format'] = ''; $meta = enlightenment_theme_option( 'portfolio_meta' ); if( $meta['author'] ) { $args['format'] .= '%1$s '; } if( $meta['date'] ) { $args['format'] .= '%2$s '; } if( $meta['project_type'] ) { $args['format'] .= enlightenment_project_types( array( 'echo' => false ) ); } if( $meta['comments'] ) { $args['format'] .= '%5$s '; } if( $meta['edit_link'] ) { $args['format'] .= '%6$s'; } } else { $args['format'] = ''; $meta = enlightenment_theme_option( 'post_meta' ); if( $meta['author'] ) { $args['format'] .= '%1$s '; } if( $meta['date'] ) { $args['format'] .= '%2$s '; } if( $meta['category'] ) { $args['format'] .= '%3$s '; } if( $meta['comments'] ) { $args['format'] .= '%5$s '; } if( $meta['edit_link'] ) { $args['format'] .= '%6$s'; } } return $args; } add_action( 'wp', 'enlightenment_remove_generated_excerpt' ); function enlightenment_remove_generated_excerpt() { if( is_singular() ) { remove_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); } } add_action( 'init', 'enlightenment_remove_excerpt_sharing_buttons' ); function enlightenment_remove_excerpt_sharing_buttons() { remove_filter( 'the_excerpt', 'sharing_display', 19 ); } function enlightenment_scroll_to_content( $args = null ) { $defaults = array( 'container' => 'div', 'container_class' => 'scroll-to-content', 'container_id' => '', 'container_extra_atts' => '', 'target' => '#content', 'icon' => '', 'screen_reader_text' => __( 'Scroll To Content', 'enlightenment' ), 'echo' => true, ); $defaults = apply_filters( 'enlightenment_scroll_to_content_args', $defaults ); $args = wp_parse_args( $args, $defaults ); $output = enlightenment_open_tag( $args['container'], $args['container_class'], $args['container_id'], $args['container_extra_atts'] ); $output .= sprintf( '', esc_attr( $args['target'] ) ); $output .= strip_tags( $args['icon'], '' ); $output .= sprintf( '%s', esc_html( $args['screen_reader_text'] ) ); $output .= ''; $output .= enlightenment_close_tag( $args['container'] ); $output = apply_filters( 'enlightenment_scroll_to_content', $output, $args ); if( ! $args['echo'] ) { return $output; } echo $output; } add_filter( 'enlightenment_scroll_to_content_args', 'enlightenment_filter_scroll_to_content_args' ); function enlightenment_filter_scroll_to_content_args( $args ) { if( is_singular() ) { $args['target'] = '#content-start'; } return $args; } add_action( 'wp', 'enlightenment_single_header_scroll_to_content' ); function enlightenment_single_header_scroll_to_content() { if( is_singular() && 'full-screen' == enlightenment_theme_option( 'header_size' ) ) { add_action( 'enlightenment_entry_header', 'enlightenment_scroll_to_content', 30 ); } } add_filter( 'enlightenment_archive_location_args', 'enlightenment_archive_location_scroll_to_content' ); function enlightenment_archive_location_scroll_to_content( $args ) { if( 'full-screen' == enlightenment_theme_option( 'header_size' ) ) { $args['after'] .= enlightenment_scroll_to_content( array( 'echo' => false ) ); } return $args; } add_action( 'enlightenment_before_sidebar', 'enlightenment_wrap_sidebar_container' ); function enlightenment_wrap_sidebar_container() { if( is_singular() ) return; $grid = enlightenment_get_grid( enlightenment_current_grid() ); if( 1 != $grid['content_columns'] && ( 'primary' == enlightenment_current_sidebar_name() || 'secondary' == enlightenment_current_sidebar_name() ) ) { add_action( 'enlightenment_before_widgets', 'enlightenment_open_sidebar_container' ); add_action( 'enlightenment_after_widgets', 'enlightenment_close_container' ); } } function enlightenment_open_sidebar_container() { echo '