__('Primary Navigation', 'bootstrap-x'), )); // post thumbnails add_theme_support('post-thumbnails'); set_post_thumbnail_size(150, 150, false); // post format support add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat')); // editor style add_editor_style('/assets/css/editor-style.css'); // Content width global $content_width; if (!isset($content_width)) { $content_width = 780; } // Custom Header $header_args = array( 'random-default' => false, 'width' => 260, 'height' => 60, 'flex-height' => true, 'flex-width' => true, 'header-text' => false, 'uploads' => true, ); add_theme_support( 'custom-header', $header_args ); add_theme_support( 'allow_flexible_header_height', 200 ); add_theme_support( 'allow_flexible_header_width', 1000 ); // Custom Backgrounds $background_args = array( 'default-color' => 'f0f0f0', 'default-repeat' => 'fixed', 'default-image' => get_template_directory_uri() . '/assets/images/pattern.png', ); add_theme_support( 'custom-background', $background_args ); // add support for woocommerce add_theme_support( 'woocommerce' ); } add_action('after_setup_theme', 'bootstrapx_setup'); /** * WP_title filter */ function bootstrapx_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'bootstrap-x' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'bootstrapx_wp_title', 10, 2 ); /** * Add and remove body_class() classes */ function bootstrapx_body_class($classes) { // Add post/page slug if (is_single() || is_page() && !is_front_page()) { $classes[] = basename(get_permalink()); } // Remove unnecessary classes $home_id_class = 'page-id-' . get_option('page_on_front'); $remove_classes = array( 'page-template-default', $home_id_class ); $classes = array_diff($classes, $remove_classes); return $classes; } add_filter('body_class', 'bootstrapx_body_class'); /** * add thumbnail class to image with caption */ function bootstrapx_caption($output, $attr, $content) { if (is_feed()) { return $output; } $defaults = array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ); $attr = shortcode_atts($defaults, $attr); // If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags if ($attr['width'] < 1 || empty($attr['caption'])) { return $content; } // Set up the attributes for the caption
$attributes = (!empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '' ); $attributes .= ' class="thumbnail wp-caption ' . esc_attr($attr['align']) . '"'; $attributes .= ' style="width: ' . (esc_attr($attr['width']) + 10) . 'px"'; $output = ''; $output .= do_shortcode($content); $output .= '
' . $attr['caption'] . '
'; $output .= '
'; return $output; } add_filter('img_caption_shortcode', 'bootstrapx_caption', 10, 3); /** * excerpt read more link */ function bootstrapx_excerpt_more($more) { return ' … ' . __('Continued', 'bootstrap-x') . ''; } add_filter('excerpt_more', 'bootstrapx_excerpt_more'); /** * search form path */ function bootstrapx_get_search_form($form) { $form = ''; locate_template('/templates/searchform.php', true, false); return $form; } add_filter('get_search_form', 'bootstrapx_get_search_form'); /** * Breadcrumbs */ function bootstrapx_breadcrumbs() { $showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $delimiter = '/'; // delimiter between crumbs $home = ''; // text for the 'Home' link $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show $before = '
  • '; // tag before the current crumb $after = '
  • '; // tag after the current crumb global $post; $homeLink = home_url(); if (is_home() || is_front_page()) { if ($showOnHome == 1) echo ''; } else { echo ''; } } /** * Protected post/page form. */ function bootstrapx_password_form() { global $post; $label = 'password-'.( empty( $post->ID ) ? rand() : $post->ID ); $password_form = '
    '.__('

    This post is password protected. To view it please enter your password below:

    ', 'bootstrap-x').'
    '; return $password_form; } add_filter( 'the_password_form', 'bootstrapx_password_form' );