__( 'Primary Menu', 'bouquet' ), ) ); // This theme allows users to set a custom background. add_theme_support( 'custom-background' ); // This theme allows users to upload a custom header. add_theme_support( 'custom-header', apply_filters( 'bouquet_custom_header_args', array( 'default-image' => '', 'default-text-color' => bouquet_header_text_color(), 'width' => 1100, 'height' => 180, 'flex-height' => true, 'wp-head-callback' => 'bouquet_header_style', 'admin-head-callback' => 'bouquet_admin_header_style', ) ) ); // Add support for Post Formats add_theme_support( 'post-formats', array( 'aside', 'image', 'gallery' ) ); } endif; // bouquet_setup // Tell WordPress to run bouquet_setup() when the 'after_setup_theme' hook is run. add_action( 'after_setup_theme', 'bouquet_setup' ); /** * Enqueue scripts and styles */ function bouquet_scripts() { wp_enqueue_style( 'bouquet', get_stylesheet_uri() ); wp_enqueue_script( 'bouquet-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'bouquet_scripts' ); // Get Bouquet options function bouquet_get_options() { $defaults = array( 'color_scheme' => 'pink-dogwood', ); return get_option( 'bouquet_theme_options', $defaults ); } // Register our color schemes and add them to the style queue function bouquet_color_registrar() { $color_scheme = bouquet_current_floral_scheme(); if ( ! empty( $color_scheme ) ) wp_enqueue_style( $color_scheme, get_template_directory_uri() . '/colors/' . $color_scheme . '/' . $color_scheme . '.css', null, null ); } add_action( 'wp_enqueue_scripts', 'bouquet_color_registrar' ); /** * Returns the current floral scheme as selected in the theme options */ function bouquet_current_floral_scheme() { $options = bouquet_get_options(); return $options['color_scheme']; } // Check the current color scheme and return a default header image that matches it function bouquet_default_header_image() { $floral_scheme = bouquet_current_floral_scheme(); return get_template_directory_uri() . '/colors/' . $floral_scheme . '/' . $floral_scheme . '-header.png'; } // Set a default header text color function bouquet_header_text_color() { return ( 'forget-me-not' == bouquet_current_floral_scheme() ) ? '123b66' : '891e42'; } /** * Add custom header support */ if ( ! function_exists( 'bouquet_header_style' ) ) : /** * Styles the header image and text displayed on the blog * */ function bouquet_header_style() { // If no custom options for text are set, let's bail if ( HEADER_TEXTCOLOR == get_header_textcolor() && '' == get_header_image() ) return; // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * */ function bouquet_admin_header_style() { ?> __( 'Sidebar 1', 'bouquet' ), 'id' => 'sidebar-1', 'description' => __( 'Drag widgets here to activate the sidebar.', 'bouquet' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'init', 'bouquet_widgets_init' ); if ( ! function_exists( 'bouquet_content_nav' ) ): // Display navigation to next/previous pages when applicable function bouquet_content_nav( $nav_id ) { global $wp_query; ?> comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="li-comment-">
    says:', 'bouquet' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    %3$s%4$s', esc_url( get_permalink() ), esc_attr( get_the_date() ), esc_html( get_the_date( 'M' ) ), esc_html( get_the_date( 'j' ) ) ); } endif; function bouquet_post_meta() { if ( is_singular() ) : /* translators: used between list items, there is a space after the comma */ $category_list = get_the_category_list( __( ', ', 'bouquet' ) ); /* translators: used between list items, there is a space after the comma */ $tag_list = get_the_tag_list( '', esc_html__( ', ', 'bouquet' ) ); if ( ! bouquet_categorized_blog() ) { // This blog only has 1 category so we just need to worry about tags in the meta text if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'This entry was posted on %5$s and tagged %2$s. Bookmark the permalink.', 'bouquet' ); } else { $meta_text = __( 'This entry was posted on %5$s. Bookmark the permalink.', 'bouquet' ); } } else { // But this blog has loads of categories so we should probably display them here if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'This entry was posted on %5$s, in %1$s and tagged %2$s. Bookmark the permalink.', 'bouquet' ); } else { $meta_text = __( 'This entry was posted on %5$s, in %1$s. Bookmark the permalink.', 'bouquet' ); } } // end check for categories on this blog printf( $meta_text, $category_list, $tag_list, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ), esc_attr( get_the_date() ) ); else : /* translators: used between list items, there is a space after the comma */ $category_list = get_the_category_list( __( ', ', 'bouquet' ) ); /* translators: used between list items, there is a space after the comma */ $tag_list = get_the_tag_list( '', esc_html__( ', ', 'bouquet' ) ); if ( ! bouquet_categorized_blog() ) { // This blog only has 1 category so we just need to worry about tags in the meta text if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'This entry was posted on %3$s and tagged %2$s.', 'bouquet' ); } else { $meta_text = __( 'This entry was posted on %3$s.', 'bouquet' ); } } else { // But this blog has loads of categories so we should probably display them here if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'This entry was posted on %3$s, in %1$s and tagged %2$s.', 'bouquet' ); } else { $meta_text = __( 'This entry was posted on %3$s, in %1$s.', 'bouquet' ); } } // end check for categories on this blog printf( $meta_text, $category_list, $tag_list, esc_attr( get_the_date() ) ); endif; } /** * Add special classes to the WordPress body class. */ function bouquet_body_classes( $classes ) { // If we have one sidebar active we have secondary content if ( ! is_active_sidebar( 'sidebar-1' ) ) $classes[] = 'one-column'; return $classes; } add_filter( 'body_class', 'bouquet_body_classes' ); // Returns true if a blog has more than 1 category function bouquet_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so bouquet_categorized_blog should return true return true; } else { // This blog has only 1 category so bouquet_categorized_blog should return false return false; } } // Flush out the transients used in bouquet_categorized_blog function bouquet_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'bouquet_category_transient_flusher' ); add_action( 'save_post', 'bouquet_category_transient_flusher' ); // Filter in a link to a content ID attribute for the next/previous image links on image attachment pages function bouquet_enhanced_image_navigation( $url ) { global $wp_rewrite; $id = (int) get_the_ID(); $object = get_post( $id ); if ( wp_attachment_is_image( $id ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) ) $url = $url . '#main'; return $url; } add_filter( 'attachment_link', 'bouquet_enhanced_image_navigation' ); // Enqueue font styles function bouquet_fonts() { wp_enqueue_style( 'sorts-mill-goudy', "https://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400" ); } add_action( 'wp_enqueue_scripts', 'bouquet_fonts' ); /** * Enqueue font style for the custom header admin page. */ function bouquet_admin_fonts( $hook_suffix ) { if ( 'appearance_page_custom-header' != $hook_suffix ) return; wp_enqueue_style( 'sorts-mill-goudy', "https://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400" ); } add_action( 'admin_enqueue_scripts', 'bouquet_admin_fonts' ); function bouquet_header_css() { // Hide the theme-provided background image if the user adds a custom background image or color if ( '' != get_background_image() || '' != get_background_color() ) : ?> tag based on what is being viewed. * * @since Bouquet 1.1 */ function bouquet_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'bouquet' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'bouquet_wp_title', 10, 2 ); /** * This theme has an options page that lets users pick layout, color scheme, * featured post title text and configure a twitter icon. */ require get_template_directory() . '/inc/theme-options.php'; /** * Load Jetpack compatibility file. */ if( class_exists( 'Jetpack' ) ) { require get_template_directory() . '/inc/jetpack.compat.php'; } /** * This theme was built with PHP, Semantic HTML, CSS, love, a Toolbox, and flowers. */