1, 'credit-in-footer' => 1) ); } static function deactivate() {} static function uninstall() { delete_option(Blogfolio::options); } static function config($key = null) { if(! self::$config) return null; if($key !== null) return @self::$config[$key]; else return self::$config; } static function after_setup_theme() { self::$config = get_option(Blogfolio::options); add_theme_support('custom-header', array( 'default-text-color' => '444', 'default-image' => '', 'width' => 718, 'height' => 80, 'flex-height' => true, 'flex-width' => true )); add_theme_support('custom-background', array( 'default-color' => '000', 'default-image' => get_template_directory_uri() . '/images/darkwood.jpg', ) ); add_theme_support('automatic-feed-links'); add_theme_support('post-thumbnails'); set_post_thumbnail_size(272, 204, true); register_nav_menu( 'primary', __('Primary Navigation', 'blogfolio') ); // hook into major sections of the site template add_action( 'blogfolio_topbar', array(self::template(), 'topbar') ); add_action( 'blogfolio_site_header', array(self::template(), 'siteHeader') ); add_action( 'blogfolio_before_content', array(self::template(), 'beforeContent') ); add_action( 'blogfolio_loop_header', array(self::template(), 'archiveHeaders') ); add_action( 'blogfolio_page_header', array(self::template(), 'pageHeader') ); add_action( 'blogfolio_page_footer', array(self::template(), 'pageFooter') ); add_action( 'blogfolio_single_header', array(self::template(), 'singleHeader') ); add_action( 'blogfolio_single_footer', array(self::template(), 'singleFooter') ); add_action( 'blogfolio_after_content', array(self::template(), 'afterContent') ); add_action( 'blogfolio_site_footer', array(self::template(), 'siteFooter') ); } static function init() { remove_action('the_excerpt', 'sharing_display', 19); } static function widgets_init() { // Content Sidebar. register_sidebar( array( 'name' => __('Content Sidebar', 'blogfolio'), 'id' => 'content-sidebar', 'description' => __('For placing widgets alongside content', 'blogfolio'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); // Site Header widget area register_sidebar( array( 'name' => __('Site Header Widget Area', 'blogfolio'), 'id' => 'site-header-widget-container', 'description' => __('For placing widgets immediately after the site header', 'blogfolio'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); // Home page widget area register_sidebar( array( 'name' => __('Home Page Widget Area', 'blogfolio'), 'id' => 'home-page-widget-container', 'description' => __('For placing widgets on the home page', 'Blogfolio'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); // Pre content Widget area register_sidebar( array( 'name' => __('Before Content Widget Area', 'blogfolio'), 'id' => 'before-content-widget-container', 'description' => __('For placing widgets before the content', 'blogfolio'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); // Post content Widget area register_sidebar( array( 'name' => __('After Content Widget Area', 'blogfolio'), 'id' => 'after-content-widget-container', 'description' => __('For placing widgets after the content', 'blogfolio'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } static function wp_enqueue_scripts() { wp_enqueue_style('css.normalize', get_template_directory_uri() . '/css/normalize.css'); wp_enqueue_style('Blogfolio.theme', get_template_directory_uri() . '/style.css'); wp_enqueue_style('wordpress.styles', get_template_directory_uri() . '/css/wordpress.styles.css'); wp_enqueue_style('wordpress.comments', get_template_directory_uri() . '/css/wordpress.comments.css'); wp_enqueue_script('html5shiv', get_template_directory_uri() . '/js/html5shiv/html5shiv.js'); } } /** * Defines template fragment loader, an enhanced version of get_template_part(). * Implements behaviour for displaying major sections of site, heavily leveraging template fragments. * Also Provides some utility functionality for showing core components of the site. * */ class BlogfolioTemplate { const fragments = 'fragments/'; static function showNavigation($themeposition) { self::loadFragment( 'navigation', $themeposition, compact('themeposition') ); } static function showWidgetContainer($widgetcontainer) { self::loadFragment( 'sidebar', $widgetcontainer, compact('widgetcontainer') ); } static function paginate($location = null) { self::loadFragment('pagination', $location); } static function loadFragment( $slug, $name = null, array $args = array() ) { $fragments = array(); if( isset($name) ) $fragments[] = self::fragments . "{$slug}-{$name}.php"; $fragments[] = self::fragments . "{$slug}.php"; foreach($fragments as $fragment) if( $template = get_stylesheet_directory() . "/$fragment" and file_exists($template) ) break; elseif( $template = get_template_directory() . "/$template" and file_exists($template) ) { break; } else $template = false; if($template) self::_loadFragment($template, $args); return $template; } private static function _loadFragment( $template, array $args = array() ) { extract($args); require($template); } function topbar() { if( Blogfolio::config('search-in-menubar') ) get_search_form(); self::showNavigation('primary'); } function siteHeader() { self::showWidgetContainer('siteheader'); } function beforeContent() { self::showWidgetContainer('beforecontent'); } function archiveHeaders() { self::loadFragment('archiveheaders'); self::loadFragment('postmeta', 'authorship'); } function pageHeader() { self::loadFragment('header', 'page'); } function pageFooter() {} function singleHeader() { self::loadFragment('header', 'single'); self::loadFragment('postmeta', 'authorship'); if( has_excerpt() ) { echo '
'; the_excerpt(); echo '
'; } } function singleFooter() { self::loadFragment('postmeta', 'classification'); } function afterContent() { self::showWidgetContainer(null); self::showWidgetContainer('aftercontent'); comments_template('', true); } function siteFooter() { self::loadFragment('sitefooter'); } } ?>