__( 'Primary Navigation', 'bootstrap' ), ) ); // This theme allows users to set a custom background add_custom_background(); } endif; /** * Function to add stylesheets to wp_head. * * */ function add_my_stylesheets() { wp_register_style( 'bootstrap-style', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'bootstrap-style' ); wp_register_style( 'extra-styles', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'extra-styles' ); wp_register_style( 'bootstrap-responsive', get_template_directory_uri() . '/css/bootstrap-responsive.css' ); wp_enqueue_style( 'bootstrap-responsive' ); } add_action('wp_enqueue_scripts', 'add_my_stylesheets'); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * */ function bootstrap_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'bootstrap_page_menu_args' ); /** * Sets the post excerpt length to 40 characters. * */ function bootstrap_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'bootstrap_excerpt_length' ); /** * Returns a "Continue" link for excerpts * */ function bootstrap_continue_reading_link() { return ' ' . __( 'Continue ', 'bootstrap' ) . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and bootstrap_continue_reading_link(). * */ function bootstrap_auto_excerpt_more( $more ) { return ' …' . bootstrap_continue_reading_link(); } add_filter( 'excerpt_more', 'bootstrap_auto_excerpt_more' ); /** * Adds a pretty "Continue" link to custom post excerpts. * */ function bootstrap_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= bootstrap_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'bootstrap_custom_excerpt_more' ); /** * Remove inline styles printed when the gallery shortcode is used. * */ add_filter( 'use_default_gallery_style', '__return_false' ); /** * Deprecated way to remove inline styles printed when the gallery shortcode is used. * * This function is no longer needed or used. Use the use_default_gallery_style * filter instead, as seen above. * */ function bootstrap_remove_gallery_css( $css ) { return preg_replace( "##s", '', $css ); } // Backwards compatibility with WordPress 3.0. if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) add_filter( 'gallery_style', 'bootstrap_remove_gallery_css' ); if ( ! function_exists( 'bootstrap_comment' ) ) : /** * Template for comments and pingbacks. * */ function bootstrap_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    says:', 'bootstrap' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • __( 'Sidebar Widget Area', 'bootstrap' ), 'id' => 'sidebar-widget-area', 'description' => __( 'The Sidebar widget area', 'bootstrap' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } /** Register sidebars by running bootstrap_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'bootstrap_widgets_init' ); /** * Removes the default styles that are packaged with the Recent Comments widget. * */ function bootstrap_remove_recent_comments_style() { add_filter( 'show_recent_comments_widget_style', '__return_false' ); } add_action( 'widgets_init', 'bootstrap_remove_recent_comments_style' ); if ( ! function_exists( 'bootstrap_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. * */ function bootstrap_posted_on() { printf( __( 'Posted on %2$s by %3$s', 'bootstrap' ), 'meta-prep meta-prep-author', sprintf( '%3$s', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), sprintf( '%3$s', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'bootstrap' ), get_the_author() ), get_the_author() ) ); } endif; if ( ! function_exists( 'bootstrap_posted_in' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). * */ function bootstrap_posted_in() { // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list ) { $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'bootstrap' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'bootstrap' ); } else { $posted_in = __( 'Bookmark the permalink.', 'bootstrap' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; /** * Bootstrap custom meny settings for downdrop support * */ class Bootstrap_Nav_Walker extends Walker_Nav_Menu { function check_current($val) { return preg_match('/(current-)/', $val); } function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ($depth) ? str_repeat("\t", $depth) : ''; $slug = sanitize_title($item->title); $id = apply_filters('nav_menu_item_id', 'menu-' . $slug, $item, $args); $id = strlen($id) ? '' . esc_attr( $id ) . '' : ''; $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes = array_filter($classes, array(&$this, 'check_current')); $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names = $class_names ? ' class="' . $id . ' ' . esc_attr($class_names) . '"' : ' class="' . $id . '"'; $output .= $indent . ''; $attributes = ! empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) .'"' : ''; $attributes .= ! empty($item->target) ? ' target="' . esc_attr($item->target ) .'"' : ''; $attributes .= ! empty($item->xfn) ? ' rel="' . esc_attr($item->xfn ) .'"' : ''; $attributes .= ! empty($item->url) ? ' href="' . esc_attr($item->url ) .'"' : ''; $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } } class Bootstrap_Navbar_Nav_Walker extends Walker_Nav_Menu { function check_current($val) { return preg_match('/(current-)|active|dropdown/', $val); } function start_lvl(&$output, $depth) { $output .= "\n