200, 'width' => 200, 'flex-height' => true, 'flex-width' => true, ) ); add_theme_support( 'post-thumbnails' ); add_image_size( 'billie-featured-posts-thumb', 360, 300 ); add_theme_support( 'title-tag' ); register_nav_menus( array( 'header' => __( 'Primary Menu', 'billie' ), 'social' => __( 'Social Menu', 'billie' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); add_theme_support( 'customize-selective-refresh-widgets' ); } } // End if(). add_action( 'after_setup_theme', 'billie_setup' ); /** * Billie_hide_title * * Unless the option is hidden in the customizer, display the site title (with link) in the primary menu. */ if ( ! get_theme_mod( 'billie_hide_title' ) ) { function billie_menu_title( $items, $args ) { if ( $args->theme_location == 'header' ) { $new_item = array( '
  • ' . esc_html( get_bloginfo( 'name' ) ) . '
  • ' ); $items = preg_replace( '/<\/li>\s
  • , __( 'Sidebar for posts', 'billie' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Front page Sidebar', 'billie' ), 'id' => 'sidebar-3', 'description' => '', 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Sidebar for archives and search results', 'billie' ), 'id' => 'sidebar-4', 'description' => '', 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Footer widget area', 'billie' ), 'id' => 'sidebar-2', 'description' => '', 'before_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Footer copyright area', 'billie' ), 'id' => 'sidebar-copyright', 'description' => __( 'Place a text widget in this area and add your copyright text', 'billie' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'billie_widgets_init' ); if ( ! function_exists( 'billie_fonts_url' ) ) : function billie_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; /* translators: If there are characters in your language that are not supported by Montserrat, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'billie' ) ) { $fonts[] = 'Montserrat'; } /* translators: To add an additional character subset specific to your language, translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'billie' ); if ( 'cyrillic' == $subset ) { $subsets .= ',cyrillic,cyrillic-ext'; } elseif ( 'greek' == $subset ) { $subsets .= ',greek,greek-ext'; } elseif ( 'devanagari' == $subset ) { $subsets .= ',devanagari'; } elseif ( 'vietnamese' == $subset ) { $subsets .= ',vietnamese'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => rawurlencode( implode( '|', $fonts ) ), 'subset' => rawurlencode( $subsets ), ), '//fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * Enqueue scripts and styles. */ function billie_scripts() { wp_enqueue_style( 'billie-style', get_stylesheet_uri(), array( 'dashicons' ) ); wp_enqueue_style( 'billie-fonts', billie_fonts_url(), array(), null ); wp_enqueue_style( 'open-sans' ); wp_enqueue_script( 'billie-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); wp_enqueue_script( 'billie-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20120206', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'billie_scripts' ); /** * Custom header for this theme. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /* Add a title to posts that are missing titles */ add_filter( 'the_title', 'billie_post_title' ); function billie_post_title( $title ) { if ( $title == '' ) { return __( '(Untitled)', 'billie' ); } else { return $title; } } function billie_no_sidebars( $classes ) { /** * Are sidebars hidden on the frontpage? * Is the sidebar activated? * Add 'no-sidebar' to the $classes array */ if ( is_front_page() && ! is_active_sidebar( 'sidebar-3' ) || is_home() && ! is_active_sidebar( 'sidebar-3' ) ) { $classes[] = 'no-sidebar'; } return $classes; } add_filter( 'body_class', 'billie_no_sidebars' ); function billie_call_to_action() { if ( ! get_theme_mod( 'billie_hide_action' ) ) { if ( get_theme_mod( 'billie_action_text' ) ) { echo '
    '; if ( get_theme_mod( 'billie_action_link' ) ) { echo '' . esc_html( get_theme_mod( 'billie_action_text' ) ) . ''; } else { echo esc_html( get_theme_mod( 'billie_action_text' ) ); } echo '
    '; } elseif ( current_user_can( 'edit_theme_options' ) ) { echo ''; } } } function billie_customize_css() { echo '' . "\n"; } add_action( 'wp_head', 'billie_customize_css' ); if ( ! function_exists( 'billie_top_sections' ) ) { function billie_top_sections() { /*The front page sections should not display on the blog listing page*/ if ( is_front_page() && is_home() || is_page_template( 'templates/sections.php' ) ) { if ( get_theme_mod( 'billie_top_section1' ) or get_theme_mod( 'billie_top_section2' ) or get_theme_mod( 'billie_top_section3' ) ) { $args = array( 'post_type' => 'page', 'orderby' => 'post__in', 'post__in' => array( get_theme_mod( 'billie_top_section1' ), get_theme_mod( 'billie_top_section2' ), get_theme_mod( 'billie_top_section3' ), ), ); $top_section_query = new WP_Query( $args ); if ( $top_section_query->have_posts() ) { echo '
    '; while ( $top_section_query->have_posts() ) : $top_section_query->the_post(); get_template_part( 'content', 'page' ); endwhile; wp_reset_postdata(); echo '
    '; } } } } } if ( ! function_exists( 'billie_bottom_sections' ) ) { function billie_bottom_sections() { /*The front page sections should not display on the blog listing page*/ if ( is_front_page() && is_home() || is_page_template( 'templates/sections.php' ) ) { if ( get_theme_mod( 'billie_bottom_section1' ) or get_theme_mod( 'billie_bottom_section2' ) or get_theme_mod( 'billie_bottom_section3' ) ) { $bottomargs = array( 'post_type' => 'page', 'orderby' => 'post__in', 'post__in' => array( get_theme_mod( 'billie_bottom_section1' ), get_theme_mod( 'billie_bottom_section2' ), get_theme_mod( 'billie_bottom_section3' ), ), ); $bottom_section_query = new WP_Query( $bottomargs ); if ( $bottom_section_query->have_posts() ) { echo '
    '; while ( $bottom_section_query->have_posts() ) : $bottom_section_query->the_post(); get_template_part( 'content', 'page' ); endwhile; wp_reset_postdata(); echo '
    '; } } } } } if ( ! function_exists( 'billie_featured_sections' ) ) { function billie_featured_sections() { if ( billie_has_featured_posts( 1 ) ) { global $post; echo ''; } } } // End if().