__( 'Widget Area for header', 'birdfield' ), 'id' => 'widget-area-header', 'description' => __( 'One text widget for header', 'birdfield' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'birdfield_widgets_init' ); ////////////////////////////////////////// // SinglePage Comment callback function birdfield_custom_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; ?>
  • id="comment-"> comment_type || 'trackback' == $comment->comment_type ): $birstips_url = get_comment_author_url(); $birstips_author = get_comment_author(); ?>
    :
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    comment_approved == '0' ) : ?>

    " conform WORDPRESS } ////////////////////////////////////////////////////// // Header markup function birdfield_wrapper_class() { $birdfield_class = 'wrapper'; if( get_theme_mod( 'birdfield_fixedheader', true ) ){ $birdfield_class .= ' fixed-header'; } if( get_theme_mod( 'birdfield_parallax', true ) ){ $birdfield_class .= ' parallax'; } if ( 'blank' == get_header_textcolor() ) { $birdfield_class .= ' no-title'; } if ( !has_nav_menu( 'primary' ) ) { $birdfield_class .= ' no-nav-menu'; } echo 'class="' .$birdfield_class .'"'; } ////////////////////////////////////////////////////// // Pagenation function birdfield_the_pagenation() { global $wp_query, $paged; $birdfield_big = 999999999; $birdfield_pages = $wp_query -> max_num_pages; if ( empty( $paged ) ) $paged = 1; if ( 1 < $birdfield_pages ) { echo '
    '."\n"; echo paginate_links( array( 'base' => str_replace( $birdfield_big, '%#%', get_pagenum_link( $birdfield_big ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $wp_query -> max_num_pages, 'mid_size' => 3, ) ); echo '
    '; } } ////////////////////////////////////////////////////// // Copyright Year function birdfield_get_copyright_year() { $birdfield_copyright_year = date("Y"); $birdfield_first_year = $birdfield_copyright_year; $args = array( 'numberposts' => 1, 'orderby' => 'post_date', 'order' => 'ASC', ); $posts = get_posts( $args ); foreach ( $posts as $post ) { $birdfield_first_year = mysql2date( 'Y', $post->post_date, true ); } if( $birdfield_copyright_year <> $birdfield_first_year ){ $birdfield_copyright_year = $birdfield_first_year .' - ' .$birdfield_copyright_year; } return $birdfield_copyright_year; } ////////////////////////////////////////////////////// // Header Style function birdfield_header_style() { //Theme Option $birdfield_text_color = esc_attr( get_theme_mod( 'birdfield_text_color', '#222327' ) ); $birdfield_link_color = esc_attr( get_theme_mod( 'birdfield_link_color', '#1c4bbe' ) ); $birdfield_header_color = esc_attr( get_theme_mod( 'birdfield_header_color', '#79a596' ) ); ?>
    >
    >
    '', 'default-color' => 'FFF', 'wp-head-callback' => 'birdfield_custom_background_cb', ) ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __( 'Navigation Menu', 'birdfield' ), ) ); // Add support for custom headers. $custom_header_support = array( // Text color and image (empty to use none). 'default-text-color' => 'FFF', 'default-image' => '', // Set height and width, with a maximum value for the width. 'height' => 900, 'width' => 1280, 'max-width' => 900, 'default-image' => '%s/images/header.jpg', // Random image rotation off by default. 'random-default' => true, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'birdfield_header_style', 'admin-head-callback' => 'birdfield_admin_header_style', 'admin-preview-callback' => 'birdfield_admin_header_image' ); add_theme_support( 'custom-header', $custom_header_support ); register_default_headers( array( 'birdfield' => array( 'url' => '%s/images/header.jpg', 'thumbnail_url' => '%s/images/header-thumbnail.jpg', 'description' => 'birdfield' ) ) ); // Add support for news content. add_theme_support( 'news-content', array( 'news_content_filter' => 'birdfield_get_news_posts', 'max_posts' => 5, ) ); } add_action( 'after_setup_theme', 'birdfield_setup' ); ////////////////////////////////////////////////////// // Filter the news posts to return function birdfield_get_news_posts(){ $array = get_posts(array( 'tag_slug__in' => 'news', 'numberposts' => 5 )); return $array; } add_filter( 'birdfield_get_news_posts', 'birdfield_get_news_posts', 100 ); ////////////////////////////////////////////////////// // Filter home and the news posts that returns a boolean value. function birdfield_has_news_posts() { return ! is_paged() && ( bool ) birdfield_get_news_posts(); } ////////////////////////////////////////////////////// // Filter main query at home function birdfield_home_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $birdfield_news = get_term_by( 'name', 'news', 'post_tag' ); if( $birdfield_news ){ $query->set( 'tag__not_in', $birdfield_news->term_id ); } } } add_action( 'pre_get_posts', 'birdfield_home_query' ); ////////////////////////////////////////////////////// // Document Title function birdfield_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', 'birdfield' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'birdfield_title' ); ////////////////////////////////////////////////////// // Enqueue Scripts function birdfield_scripts() { if ( is_singular() && comments_open() && get_option('thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'jquerytile', get_template_directory_uri() .'/js/jquery.tile.min.js', 'jquery', '20140801' ); wp_enqueue_script( 'birdfield', get_template_directory_uri() .'/js/birdfield.js', 'jquery', '1.04' ); wp_enqueue_style( 'birdfield-google-font', '//fonts.googleapis.com/css?family=Raleway', false, null, 'all' ); wp_enqueue_style( 'birdfield', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'birdfield_scripts' ); ////////////////////////////////////////////////////// // Enqueue Scripts for admin function birdfield_admin_scripts( $hook_suffix ) { if ( 'appearance_page_custom-header' != $hook_suffix ) return; wp_enqueue_style( 'birdfield-google-font', '//fonts.googleapis.com/css?family=Raleway', false, null, 'all' ); } add_action( 'admin_enqueue_scripts', 'birdfield_admin_scripts' ); ////////////////////////////////////////////////////// // Theme Customizer function birdfield_customize($wp_customize) { // Text Color $wp_customize->add_setting( 'birdfield_text_color', array( 'default' => '#222327', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdfield_text_color', array( 'label' => __( 'Text Color', 'birdfield' ), 'section' => 'colors', 'settings' => 'birdfield_text_color', ) ) ); // Link Color $wp_customize->add_setting( 'birdfield_link_color', array( 'default' => '#1c4bbe', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdfield_link_color', array( 'label' => __( 'Link Color', 'birdfield' ), 'section' => 'colors', 'settings' => 'birdfield_link_color', ) ) ); // Header, Footer Background Color $wp_customize->add_setting( 'birdfield_header_color', array( 'default' => '#79a596', 'sanitize_callback' => 'maybe_hash_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'birdfield_header_color', array( 'label' => __( 'Header, Footer Background Color', 'birdfield' ), 'section' => 'colors', 'settings' => 'birdfield_header_color', ) ) ); // Parallax Header Image $wp_customize->add_setting( 'birdfield_parallax', array( 'default' => true, 'sanitize_callback' => 'birdfield_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdfield_parallax', array( 'label' => __( 'Display Parallax', 'birdfield' ), 'section' => 'header_image', 'type' => 'checkbox', 'settings' => 'birdfield_parallax', ) ); // Fixed Menu $wp_customize->add_setting( 'birdfield_fixedheader', array( 'default' => true, 'sanitize_callback' => 'birdfield_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdfield_fixedheader', array( 'label' => __( 'Fixed Header', 'birdfield' ), 'section' => 'nav', 'type' => 'checkbox', 'settings' => 'birdfield_fixedheader', ) ); // Footer Section $wp_customize->add_section( 'birdfield_customize', array( 'title' => __( 'Footer', 'birdfield' ), 'priority' => 999, ) ); // Display Copyright $wp_customize->add_setting( 'birdfield_copyright', array( 'default' => true, 'sanitize_callback' => 'birdfield_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdfield_copyright', array( 'label' => __( 'Display Copyright', 'birdfield' ), 'section' => 'birdfield_customize', 'type' => 'checkbox', 'settings' => 'birdfield_copyright', ) ); // Display Credit $wp_customize->add_setting( 'birdfield_credit', array( 'default' => true, 'sanitize_callback' => 'birdfield_sanitize_checkbox', ) ); $wp_customize->add_control( 'birdfield_credit', array( 'label' => __( 'Display Credit', 'birdfield' ), 'section' => 'birdfield_customize', 'type' => 'checkbox', 'settings' => 'birdfield_credit', ) ); } add_action( 'customize_register', 'birdfield_customize' ); ////////////////////////////////////////////////////// // Santize a checkbox function birdfield_sanitize_checkbox( $input ) { if ( $input == true ) { return true; } else { return false; } } ////////////////////////////////////////////////////// // Excerpt More function birdfield_excerpt_more($more) { return '' .__( 'Continue reading', 'birdfield' ) . ''; } add_filter('excerpt_more', 'birdfield_excerpt_more'); ////////////////////////////////////////////////////// // Removing the default gallery style function birdfield_gallery_atts( $out, $pairs, $atts ) { $atts = shortcode_atts( array( 'size' => 'medium', ), $atts ); $out['size'] = $atts['size']; return $out; } add_filter( 'shortcode_atts_gallery', 'birdfield_gallery_atts', 10, 3 ); add_filter( 'use_default_gallery_style', '__return_false' ); ////////////////////////////////////////////////////// // Custom Background callback function birdfield_custom_background_cb() { // $background is the saved custom image, or the default image. $background = set_url_scheme( get_background_image() ); // $color is the saved custom color. // A default has to be specified in style.css. It will not be printed here. $color = get_background_color(); if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) { $color = false; } if ( ! $background && ! $color ) return; $style = $color ? "background-color: #$color;" : ''; if ( $background ) { $image = " background-image: url('$background');"; $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ); if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) $repeat = 'repeat'; $repeat = " background-repeat: $repeat;"; $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) ) $position = 'left'; $position = " background-position: top $position;"; $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ); if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) ) $attachment = 'scroll'; $attachment = " background-attachment: $attachment;"; $style .= $image . $repeat . $position . $attachment; } ?>