'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(Blogfolio::imp(), 'topbar') ); add_action( 'blogfolio_site_header', array(Blogfolio::imp(), 'siteHeader') ); add_action( 'blogfolio_before_content', array(Blogfolio::imp(), 'beforeContent') ); add_action( 'blogfolio_loop_header', array(Blogfolio::imp(), 'archiveHeaders') ); add_action( 'blogfolio_page_header', array(Blogfolio::imp(), 'pageHeader') ); add_action( 'blogfolio_page_footer', array(Blogfolio::imp(), 'pageFooter') ); add_action( 'blogfolio_single_header', array(Blogfolio::imp(), 'singleHeader') ); add_action( 'blogfolio_single_footer', array(Blogfolio::imp(), 'singleFooter') ); add_action( 'blogfolio_after_content', array(Blogfolio::imp(), 'afterContent') ); add_action( 'blogfolio_site_footer', array(Blogfolio::imp(), 'siteFooter') ); }); // stop sharing options from showing up in excerpt if using JetPack add_action('init', function(){ remove_action('the_excerpt', 'sharing_display', 19); }); add_action('widgets_init', function() { // 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' => '

' )); // 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' => '

' )); }); add_action('admin_init', function() { add_settings_section('general_settings_section', 'Blogfolio Theme Settings', null, 'general'); }); add_action( 'admin_menu', array('BlogfolioAdmin', 'hookThemeMenu') ); /** * Provides some utility functionality for showing core components of the site. * Also defines template fragment loader, an enhanced version of get_template_part() * */ class Blogfolio { const fragments = 'fragments/'; static private $imp = null; static function imp() { if(! self::$imp) self::$imp = new BlogfolioImp; return self::$imp; } static function showNavigation($themeposition) { self::loadFragment( 'navigation', $themeposition, compact('themeposition') ); } static function showWidgetContainer($widgetcontainer) { Blogfolio::loadFragment( 'sidebar', $widgetcontainer, compact('widgetcontainer') ); } static function paginate($location = null) { Blogfolio::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); } } /** * Implements behaviour for displaying major sections of site. Heavily leverages template fragments. */ class BlogfolioImp { function topbar() { get_search_form(); Blogfolio::showNavigation('primary'); } function siteHeader() {} function beforeContent() { Blogfolio::showWidgetContainer('beforecontent'); } function archiveHeaders() { Blogfolio::loadFragment('archiveheaders'); Blogfolio::loadFragment('postmeta', 'authorship'); } function pageHeader() { Blogfolio::loadFragment('header', 'page'); } function pageFooter() {} function singleHeader() { Blogfolio::loadFragment('header', 'single'); Blogfolio::loadFragment('postmeta', 'authorship'); if( has_excerpt() ) { echo '
'; the_excerpt(); echo '
'; } } function singleFooter() { Blogfolio::loadFragment('postmeta', 'classification'); } function afterContent() { Blogfolio::showWidgetContainer(null); Blogfolio::showWidgetContainer('aftercontent'); Blogfolio::loadFragment('comments'); } function siteFooter() {} } /** * Sets up custom options administrative panel for theme. */ class BlogfolioAdmin { function hookThemeMenu() { add_theme_page( 'Blogfolio theme settings', 'Blogfolio Settings', 'administrator', 'blogfolio-theme-settings', array('BlogfolioAdmin', 'showThemeSettings') ); } function showThemeSettings(){ Blogfolio::loadFragment('adminsettings'); } function addField($id, $name, $label, $renderer, $page = 'general', $section = 'general_settings_section') { add_settings_field( $id, $name, $renderer, $page, $section, array($label) ); } } ?>