'scroll', 'footer_widgets' => array( 'sidebar-2', 'sidebar-3', 'sidebar-4' ), 'container' => 'content', 'wrapper' => false, 'render' => 'hatch_infinite_scroll_render', 'footer' => 'page', 'posts_per_page' => '8' ) ); /** * Enable support for Post Thumbnails */ add_theme_support( 'post-thumbnails' ); add_image_size( 'home-thumb', '440', '300', true ); add_image_size( 'large-thumb', '1280', '9999', false ); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Primary Menu', 'hatch' ), ) ); /** * Add support for custom backgrounds */ add_theme_support( 'custom-background' ); } endif; // hatch_setup add_action( 'after_setup_theme', 'hatch_setup' ); /** * Add a rendering function for infinite scroll so styles are applied consistently */ function hatch_infinite_scroll_render() { global $hatch_counter; $hatch_counter = 1; while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() ); $hatch_counter++; endwhile; } /** * Register widgetized area and update sidebar with default widgets * * @since Hatch 1.0 */ function hatch_widgets_init() { register_sidebar( array( 'name' => __( 'Page Sidebar', 'hatch' ), 'description' => __( 'This sidebar appears only on Pages.', 'hatch' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Sidebar 1', 'hatch' ), 'id' => 'sidebar-2', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Sidebar 2', 'hatch' ), 'id' => 'sidebar-3', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Sidebar 3', 'hatch' ), 'id' => 'sidebar-4', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'After Single Posts', 'hatch' ), 'id' => 'sidebar-5', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'hatch_widgets_init' ); /** * Enqueue scripts and styles */ function hatch_scripts() { wp_enqueue_style( 'style', get_stylesheet_uri() ); wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'hatch-script', get_template_directory_uri() . '/js/hatch.js', array( 'jquery' ), '20121029', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'hatch_scripts' ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Add theme options in the Customizer */ function hatch_customize( $wp_customize ) { /* Add a textarea field option */ class Hatch_Customize_Textarea_Control extends WP_Customize_Control { public $type = 'textarea'; public function render_content() { ?> add_section( 'hatch_settings', array( 'title' => 'Theme Options', 'priority' => 35, ) ); $wp_customize->add_setting( 'hatch_intro' ); $wp_customize->add_control( new Hatch_Customize_Textarea_Control( $wp_customize, 'hatch_intro', array( 'label' => 'Brief introduction (appears on the home page)', 'section' => 'hatch_settings', ) ) ); $wp_customize->add_setting( 'hatch_logo' ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hatch_logo', array( 'label' => 'Upload a logo', 'section' => 'hatch_settings', ) ) ); } add_action( 'customize_register', 'hatch_customize' );