__( 'Widget Area for footer left', 'birdsite' ), 'id' => 'widget-area-footer-left', 'description' => __( 'Widget Area for footer left', 'birdsite' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array ( 'name' => __( 'Widget Area for footer center', 'birdsite' ), 'id' => 'widget-area-footer-center', 'description' => __( 'Widget Area for footer center', 'birdsite' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array ( 'name' => __( 'Widget Area for footer right', 'birdsite' ), 'id' => 'widget-area-footer-right', 'description' => __( 'Widget Area for footer right', 'birdsite' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'birdsite_widgets_init' ); ////////////////////////////////////////////////////// // Pagenation function birdsite_the_pagenation() { global $wp_query, $paged; $birdsite_big = 999999999; $birdsite_pages = $wp_query -> max_num_pages; if ( empty( $paged ) ) $paged = 1; if ( 1 < $birdsite_pages ) { echo '
' ."\n"; echo paginate_links( array( 'base' => str_replace( $birdsite_big, '%#%', get_pagenum_link( $birdsite_big ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query -> max_num_pages, 'mid_size' => 3, 'prev_text' => __( 'Previous', 'birdsite' ), 'next_text' => __( 'Next', 'birdsite' ) ) ); echo '
' ."\n";; } } ////////////////////////////////////////////////////// // Copyright Year function birdsite_get_copyright_year() { $birdsite_copyright_year = date( "Y" ); $birdsite_first_year = $birdsite_copyright_year; $args = array( 'numberposts' => 1, 'orderby' => 'post_date', 'order' => 'ASC', ); $posts = get_posts( $args ); foreach ( $posts as $post ) { $birdsite_first_year = mysql2date( 'Y', $post->post_date, true ); } if( $birdsite_copyright_year <> $birdsite_first_year ){ $birdsite_copyright_year = $birdsite_first_year .' - ' .$birdsite_copyright_year; } return $birdsite_copyright_year; } ////////////////////////////////////////////////////// // Header Style function birdsite_header_style() { ?> 'F5F5F5', ) ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __( 'Navigation Menu', 'birdsite' ), ) ); // Add support for title tag. add_theme_support( 'title-tag' ); // Add support for custom headers. add_theme_support( 'custom-header', array( 'default-text-color' => '000', 'default-image' => '', 'height' => 300, 'width' => 600, 'max-width' => 600, 'random-default' => true, 'wp-head-callback' => 'birdsite_header_style', ) ); register_default_headers( array( 'blue' => array( 'url' => '%s/images/headers/blue.jpg', 'thumbnail_url' => '%s/images/headers/blue-thumbnail.jpg', 'description' => 'blue' ), 'yellow' => array( 'url' => '%s/images/headers/yellow.jpg', 'thumbnail_url' => '%s/images/headers/yellow-thumbnail.jpg', 'description' => 'yellow' ), 'pink' => array( 'url' => '%s/images/headers/pink.jpg', 'thumbnail_url' => '%s/images/headers/pink-thumbnail.jpg', 'description' => 'pink' ), 'navy' => array( 'url' => '%s/images/headers/navy.jpg', 'thumbnail_url' => '%s/images/headers/navy-thumbnail.jpg', 'description' => 'navy' ), 'red' => array( 'url' => '%s/images/headers/red.jpg', 'thumbnail_url' => '%s/images/headers/red-thumbnail.jpg', 'description' => 'red' ), 'green' => array( 'url' => '%s/images/headers/green.jpg', 'thumbnail_url' => '%s/images/headers/green-thumbnail.jpg', 'description' => 'green' ), ) ); } add_action( 'after_setup_theme', 'birdsite_setup' ); ////////////////////////////////////////////////////// // Document Title function birdsite_title( $title ) { global $page, $paged; $title .= get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " | $site_description"; if ( $paged >= 2 || $page >= 2 ) $title .= ' | ' . sprintf( __( 'Page %s', 'birdsite' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'birdsite_title' ); ////////////////////////////////////////////////////// // Title Tag Backwards Compatibility function birdsite_slug_render_title() { ?><?php wp_title( '|', true, 'right' ); ?>add_setting( 'birdsite_text_color', array( 'default' => '#555', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdsite_text_color', array( 'label' => __( 'Text Color', 'birdsite' ), 'section' => 'colors', 'settings' => 'birdsite_text_color', ) ) ); // Link Color $wp_customize->add_setting( 'birdsite_link_color', array( 'default' => '#06A', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdsite_link_color', array( 'label' => __( 'Link Color', 'birdsite' ), 'section' => 'colors', 'settings' => 'birdsite_link_color', ) ) ); // Header, Footer Color $wp_customize->add_setting( 'birdsite_footer_color', array( 'default' => '#000', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdsite_footer_color', array( 'label' => __( 'Header, Footer Color', 'birdsite' ), 'section' => 'colors', 'settings' => 'birdsite_footer_color', ) ) ); // Navigation Text Color $wp_customize->add_setting( 'birdsite_navigation_color', array( 'default' => '#555', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdsite_navigation_color', array( 'label' => __( 'Navigation Text Color', 'birdsite' ), 'section' => 'colors', 'settings' => 'birdsite_navigation_color', ) ) ); // Home Section $wp_customize->add_section( 'birdsite_home', array( 'title' => __( 'Home', 'birdsite' ), 'priority' => 999, ) ); // Display Date $wp_customize->add_setting( 'birdsite_home_postdate', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_home_postdate', array( 'label' => __( 'Display Postate', 'birdsite' ), 'section' => 'birdsite_home', 'type' => 'checkbox', 'settings' => 'birdsite_home_postdate', ) ); // Display Author $wp_customize->add_setting( 'birdsite_home_author', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_home_author', array( 'label' => __( 'Display Author', 'birdsite' ), 'section' => 'birdsite_home', 'type' => 'checkbox', 'settings' => 'birdsite_home_author', ) ); // Display Category $wp_customize->add_setting( 'birdsite_home_category', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_home_category', array( 'label' => __( 'Display Category', 'birdsite' ), 'section' => 'birdsite_home', 'type' => 'checkbox', 'settings' => 'birdsite_home_category', ) ); // Display Tags $wp_customize->add_setting( 'birdsite_home_tags', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_home_tags', array( 'label' => __( 'Display Tags', 'birdsite' ), 'section' => 'birdsite_home', 'type' => 'checkbox', 'settings' => 'birdsite_home_tags', ) ); // Display Comment Number $wp_customize->add_setting( 'birdsite_home_comment_number', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_home_comment_number', array( 'label' => __( 'Display Comment Number', 'birdsite' ), 'section' => 'birdsite_home', 'type' => 'checkbox', 'settings' => 'birdsite_home_comment_number', ) ); // Footer Section $wp_customize->add_section( 'birdsite_footer', array( 'title' => __( 'Footer', 'birdsite' ), 'priority' => 999, ) ); // Display Copyright $wp_customize->add_setting( 'birdsite_copyright', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_copyright', array( 'label' => __( 'Display Copyright', 'birdsite' ), 'section' => 'birdsite_footer', 'type' => 'checkbox', 'settings' => 'birdsite_copyright', ) ); // Display Credit $wp_customize->add_setting( 'birdsite_credit', array( 'default' => true, 'sanitize_callback' => 'birdsite_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdsite_credit', array( 'label' => __( 'Display Credit', 'birdsite' ), 'section' => 'birdsite_footer', 'type' => 'checkbox', 'settings' => 'birdsite_credit', ) ); } add_action( 'customize_register', 'birdsite_customize' ); ////////////////////////////////////////////////////// // Santize a checkbox function birdsite_sanitize_checkbox( $input ) { if ( $input == true ) { return true; } else { return false; } } ////////////////////////////////////////////////////// // Removing the default gallery style function birdsite_gallery_atts( $out, $pairs, $atts ) { $atts = shortcode_atts( array( 'size' => 'medium', ), $atts ); $out['size'] = $atts['size']; return $out; } add_filter( 'shortcode_atts_gallery', 'birdsite_gallery_atts', 10, 3 ); add_filter( 'use_default_gallery_style', '__return_false' ); ////////////////////////////////////////////////////// // Display the Featured Image at home function birdsite_the_post_thumbnail() { $birdsite_thumbnail_size = 240; $birdsite_thumbnail_width = $birdsite_thumbnail_size; $birdsite_thumbnail_height = $birdsite_thumbnail_size; $birdsite_thumbnail_id = get_post_thumbnail_id(); $birdsite_thumbnail_attr = wp_get_attachment_metadata( $birdsite_thumbnail_id ); if( $birdsite_thumbnail_attr['width'] > $birdsite_thumbnail_attr['height'] ){ // Horizontal Thumbnail $birdsite_thumbnail_width = intval( ( $birdsite_thumbnail_attr['width'] / $birdsite_thumbnail_attr['height'] ) * $birdsite_thumbnail_height ); } else{ // Vertical Thumbnail $birdsite_thumbnail_height = intval( ( $birdsite_thumbnail_attr['height'] / $birdsite_thumbnail_attr['width'] ) * $birdsite_thumbnail_width ); } $birdsite_thumbnail_top = intval( ( $birdsite_thumbnail_size - $birdsite_thumbnail_height ) /2 ); $birdsite_thumbnail_left = intval( ( $birdsite_thumbnail_size - $birdsite_thumbnail_width ) /2 ); $birdsite_attr = array( 'style' => 'width: ' .$birdsite_thumbnail_width .'px; height: ' .$birdsite_thumbnail_height .'px; left: ' .$birdsite_thumbnail_left .'px; top: ' .$birdsite_thumbnail_top .'px;' ); the_post_thumbnail( 'large', $birdsite_attr ); }