__( 'Main Navigation', 'the-bootstrap' ), 'header-menu' => __( 'Header Menu', 'the-bootstrap' ), 'footer-menu' => __( 'Footer Menu', 'the-bootstrap' ) ) ); } // the_bootstrap_setup endif; add_action( 'after_setup_theme', 'the_bootstrap_setup' ); /** * Returns the options object for The Bootstrap. * * @author Automattic * @since 1.3.0 - 06.04.2012 * * @return stdClass Theme Options */ function the_bootstrap_options() { return (object) wp_parse_args( get_option( 'the_bootstrap_theme_options', array() ), the_bootstrap_get_default_theme_options() ); } /** * Returns the default options for The Bootstrap. * * @author Automattic * @since 1.3.0 - 06.04.2012 * * @return void */ function the_bootstrap_get_default_theme_options() { $default_theme_options = array( 'theme_layout' => 'content-sidebar', 'navbar_site_name' => false, 'navbar_searchform' => true, 'navbar_inverse' => true, 'navbar_position' => 'static', ); return apply_filters( 'the_bootstrap_default_theme_options', $default_theme_options ); } /** * Adds The Bootstrap layout classes to the array of body classes. * * @author WordPress.org * @since 1.3.0 - 06.04.2012 * * @return void */ function the_bootstrap_layout_classes( $existing_classes ) { $classes = array( the_bootstrap_options()->theme_layout ); $classes = apply_filters( 'the_bootstrap_layout_classes', $classes ); return array_merge( $existing_classes, $classes ); } add_filter( 'body_class', 'the_bootstrap_layout_classes' ); /** * Adds Custom Background support * * @author Konstantin Obenland * @since 1.2.5 - 11.04.2012 * * @return void */ function the_bootstrap_custom_background_setup() { $args = apply_filters( 'the_bootstrap_custom_background_args', array( 'default-color' => 'EFEFEF', ) ); add_theme_support( 'custom-background', $args ); if ( ! function_exists( 'wp_get_theme' ) ) { // Compat: Versions of WordPress prior to 3.4. define( 'BACKGROUND_COLOR', $args['default-color'] ); add_custom_background(); } } add_action( 'after_setup_theme', 'the_bootstrap_custom_background_setup' ); /** * Register the sidebars. * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function the_bootstrap_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'the-bootstrap' ), 'id' => 'main', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Image Sidebar', 'the-bootstrap' ), 'description' => __( 'Shown on image attachment pages.', 'the-bootstrap' ), 'id' => 'image', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); include_once( 'inc/the-bootstrap-image-meta-widget.php' ); register_widget( 'The_Bootstrap_Image_Meta_Widget' ); include_once( 'inc/the-bootstrap-gallery-widget.php' ); register_widget( 'The_Bootstrap_Gallery_Widget' ); } add_action( 'widgets_init', 'the_bootstrap_widgets_init' ); /** * Registration of theme scripts and styles * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function the_bootstrap_register_scripts_styles() { if ( ! is_admin() ) { $theme_version = _the_bootstrap_version(); $suffix = ( defined('SCRIPT_DEBUG') AND SCRIPT_DEBUG ) ? '' : '.min'; /** * Scripts */ wp_register_script( 'tw-bootstrap', get_template_directory_uri() . "/js/bootstrap{$suffix}.js", array('jquery'), '2.0.3', true ); wp_register_script( 'the-bootstrap', get_template_directory_uri() . "/js/the-bootstrap{$suffix}.js", array('tw-bootstrap'), $theme_version, true ); /** * Styles */ wp_register_style( 'tw-bootstrap', get_template_directory_uri() . "/css/bootstrap{$suffix}.css", array(), '2.0.3' ); wp_register_style( 'the-bootstrap', get_template_directory_uri() . "/style{$suffix}.css", array('tw-bootstrap'), $theme_version ); } } add_action( 'init', 'the_bootstrap_register_scripts_styles' ); /** * Properly enqueue frontend scripts * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function the_bootstrap_print_scripts() { wp_enqueue_script( 'the-bootstrap' ); } add_action( 'wp_enqueue_scripts', 'the_bootstrap_print_scripts' ); /** * Adds IE specific scripts * * Respond.js has to be loaded after Theme styles * * @author Konstantin Obenland * @since 1.7.0 - 11.06.2012 * * @return void */ function the_bootstrap_print_ie_scripts() { ?> navbar_position ) { $top_bottom = str_replace( 'navbar-fixed-', '', the_bootstrap_options()->navbar_position ); $css = "body > .container{margin-{$top_bottom}:68px;}@media(min-width: 980px){body > .container{margin-{$top_bottom}:58px;}}"; if ( is_admin_bar_showing() AND 'top' == $top_bottom ) $css .= '.navbar.navbar-fixed-top{margin-top:28px;}'; if ( function_exists( 'wp_add_inline_style' ) ) wp_add_inline_style( 'the-bootstrap', $css ); else echo "\n"; } } add_action( 'wp_enqueue_scripts', 'the_bootstrap_print_styles' ); if ( ! function_exists( 'the_bootstrap_credits' ) ) : /** * Prints HTML with meta information for the current post-date/time and author, * comment and edit link * * @author Konstantin Obenland * @since 1.2.2 - 07.04.2012 * * @return void */ function the_bootstrap_credits() { printf( '' . __( '© %1$s %3$s, all rights reserved.', 'the-bootstrap' ) . '', date( 'Y' ), home_url( '/' ), get_bloginfo( 'name' ) ); } endif; /** * Returns the blogname if no title was set. * * @author Konstantin Obenland * @since 1.1.0 - 18.03.2012 * * @param string $title * @param string $sep * * @return string */ function the_bootstrap_wp_title( $title, $sep ) { if ( ! is_feed() ) { $title .= get_bloginfo( 'name' ); if ( is_front_page() ) { $title .= " {$sep} " . get_bloginfo( 'description' ); } } return $title; } add_filter( 'wp_title', 'the_bootstrap_wp_title', 1, 2 ); /** * Returns a "Continue Reading" link for excerpts * * @author WordPress.org * @since 1.0.0 - 05.02.2012 * * @param string $more * * @return string */ function the_bootstrap_continue_reading_link() { return ' ' . __( 'Continue reading ', 'the-bootstrap' ) . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and the_bootstrap_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. * * @author WordPress.org * @since 1.0.0 - 05.02.2012 * * @param string $more * * @return string */ function the_bootstrap_auto_excerpt_more( $more ) { return '…' . the_bootstrap_continue_reading_link(); } add_filter( 'excerpt_more', 'the_bootstrap_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * To override this link in a child theme, remove the filter and add your own * function tied to the get_the_excerpt filter hook. * * @author WordPress.org * @since 1.0.0 - 05.02.2012 * * @param string $output * * @return string */ function the_bootstrap_custom_excerpt_more( $output ) { if ( has_excerpt() AND ! is_attachment() ) { $output .= the_bootstrap_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'the_bootstrap_custom_excerpt_more' ); /** * Get the wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * @author WordPress.org * @since 1.0.0 - 05.02.2012 * * @param array $args * * @return array */ function the_bootstrap_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'the_bootstrap_page_menu_args' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages * * @author Automattic * @since 1.0.0 - 05.02.2012 * * @param string $url * @param int $id * * @return string */ function the_bootstrap_enhanced_image_navigation( $url, $id ) { if ( is_attachment() AND wp_attachment_is_image( $id ) ) { $image = get_post( $id ); if ( $image->post_parent AND $image->post_parent != $id ) $url .= '#primary'; } return $url; } add_filter( 'attachment_link', 'the_bootstrap_enhanced_image_navigation', 10, 2 ); /** * Displays comment list, when there are any * * @author Konstantin Obenland * @since 1.7.0 - 16.06.2012 * * @return void */ function the_bootstrap_comments_list() { if ( post_password_required() ) : ?>

' . get_the_title() . '' ); ?>

    'the_bootstrap_comment' ) ); ?>

'
', 'comment_notes_before' => '', 'comment_notes_after' => '
' . allowed_tags() . '
' ) . '
', 'title_reply' => '' . __( 'Leave a reply', 'the-bootstrap' ) . '', 'title_reply_to' => '' . __( 'Leave a reply to %s', 'the-bootstrap' ). '', 'must_log_in' => '
' . sprintf( __( 'You must be logged in to post a comment.', 'the-bootstrap' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( get_the_ID() ) ) ) ) . '
', 'logged_in_as' => '
' . sprintf( __( 'Logged in as %2$s. Log out?', 'the-bootstrap' ), admin_url( 'profile.php' ), wp_get_current_user()->display_name, wp_logout_url( apply_filters( 'the_permalink', get_permalink( get_the_ID() ) ) ) ) . '
', ), $defaults ); } add_filter( 'comment_form_defaults', 'the_bootstrap_comment_form_defaults' ); if ( ! function_exists( 'the_bootstrap_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own the_bootstrap_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param object $comment Comment data object. * @param array $args * @param int $depth Depth of comment in reference to parents. * * @return void */ function the_bootstrap_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; if ( 'pingback' == $comment->comment_type OR 'trackback' == $comment->comment_type ) : ?>
  • >

     ', '' ); ?>

  • >
    ">

    said on %2$s:', 'the-bootstrap' ), sprintf( '%s', get_comment_author_link() ), sprintf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'the-bootstrap' ), get_comment_date(), get_comment_time() ) ) ); edit_comment_link( __( 'Edit', 'the-bootstrap' ), ' ', '' ); ?>

    comment_approved ) : ?>
    __( 'Reply ', 'the-bootstrap' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    '; } add_action( 'comment_form_top', 'the_bootstrap_comment_form_top' ); /** * Adds markup to the comment form which is needed to make it work with Bootstrap * needs * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $html * * @return string */ function the_bootstrap_comment_form() { echo '
  • '; } add_action( 'comment_form', 'the_bootstrap_comment_form' ); /** * Custom author form field for the comments form * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $html * * @return string */ function the_bootstrap_comment_form_field_author( $html ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); return '
    ' . ( $req ? '

    ' . __('required', 'the-bootstrap') . '

    ' : '' ) . '
    '; } add_filter( 'comment_form_field_author', 'the_bootstrap_comment_form_field_author'); /** * Custom HTML5 email form field for the comments form * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $html * * @return string */ function the_bootstrap_comment_form_field_email( $html ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); return '

    ' . ( $req ? '' . __('required', 'the-bootstrap') . ', ' : '' ) . __( 'will not be published', 'the-bootstrap' ) . '

    '; } add_filter( 'comment_form_field_email', 'the_bootstrap_comment_form_field_email'); /** * Custom HTML5 url form field for the comments form * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $html * * @return string */ function the_bootstrap_comment_form_field_url( $html ) { $commenter = wp_get_current_commenter(); return '
    '; } add_filter( 'comment_form_field_url', 'the_bootstrap_comment_form_field_url'); /** * Adjusts an attechment link to hold the class of 'thumbnail' and make it look * pretty * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $link * @param int $id Post ID. * @param string $size Default is 'thumbnail'. Size of image, either array or string. * @param bool $permalink Default is false. Whether to add permalink to image. * @param bool $icon Default is false. Whether to include icon. * @param string $text Default is false. If string, then will be link text. * * @return string */ function the_bootstrap_get_attachment_link( $link, $id, $size, $permalink, $icon, $text ) { return ( ! $text ) ? str_replace( ' 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'figure', 'icontag' => 'div', 'captiontag' => 'figcaption', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '' ), $attr ) ); $id = intval( $id ); if ( 'RAND' == $order ) $orderby = 'none'; if ( $include ) { $include = preg_replace( '/[^0-9,]+/', '', $include ); $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( $exclude ) { $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( empty( $attachments ) ) return; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n"; return $output; } $itemtag = tag_escape( $itemtag ); $captiontag = tag_escape( $captiontag ); $columns = intval( min( array( 8, $columns ) ) ); $float = (is_rtl()) ? 'right' : 'left'; if ( 4 > $columns ) $size = 'full'; $selector = "gallery-{$instance}"; $size_class = sanitize_html_class( $size ); $output = "\n"; return $output; } add_filter( 'post_gallery', 'the_bootstrap_post_gallery', 10, 2 ); /** * HTML 5 caption for pictures * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $empty * @param array $attr * @param string $content * * @return string */ function the_bootstrap_img_caption_shortcode( $empty, $attr, $content ) { extract( shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr ) ); if ( 1 > (int) $width OR empty( $caption ) ) { return $content; } if ( $id ) { $id = 'id="' . $id . '" '; } return '
    ' . do_shortcode( str_replace( 'class="thumbnail', 'class="', $content ) ) . '
    ' . $caption . '
    '; } add_filter( 'img_caption_shortcode', 'the_bootstrap_img_caption_shortcode', 10, 3 ); /** * Returns a password form which dispalys nicely with Bootstrap * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @param string $form * * @return string The Bootstrap password form */ function the_bootstrap_the_password_form( $form ) { return '
    '. __( 'This post is password protected. To view it please enter your password below:', 'the-bootstrap' ) . '
    '; } add_filter( 'the_password_form', 'the_bootstrap_the_password_form' ); /** * Modifies the category dropdown args for widgets on 404 pages * * @author Konstantin Obenland * @since 1.5.0 - 19.05.2012 * * @param array $args * * @return array */ function the_bootstrap_widget_categories_dropdown_args( $args ) { if ( is_404() ) { $args = wp_parse_args( $args, array( 'orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10 ) ); } return $args; } add_filter( 'widget_categories_dropdown_args', 'the_bootstrap_widget_categories_dropdown_args' ); /** * Adds the .thumbnail class when images are sent to editor * * @author Konstantin Obenland * @since 2.0.0 - 29.08.2012 * * @param string $html * @param int $id * @param string $caption * @param string $title * @param string $align * @param string $url * @param string $size * @param string $alt * * @return string Image HTML */ function the_bootstrap_image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ) { if ( $url ) { $html = str_replace( '
    get( 'Version' ); } else { $theme_data = get_theme_data( get_template_directory() . '/style.css' ); $theme_version = $theme_data['Version']; } return $theme_version; } /* End of file functions.php */ /* Location: ./wp-content/themes/the-bootstrap/functions.php */