tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'britt' ),
) );
/*
* 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',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'britt_custom_background_args', array(
'default-color' => '000000',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'britt_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function britt_content_width() {
$GLOBALS['content_width'] = apply_filters( 'britt_content_width', 640 );
}
add_action( 'after_setup_theme', 'britt_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function britt_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'britt' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
register_widget( 'Britt_About_Me' );
}
add_action( 'widgets_init', 'britt_widgets_init' );
require get_template_directory() . "/widgets/about-me.php";
/**
* Enqueue scripts and styles.
*/
function britt_scripts() {
wp_enqueue_style( 'britt-style', get_stylesheet_uri() );
$body_font = get_theme_mod('body_fonts', '');
$headings_font = get_theme_mod('headings_fonts', '');
$remove = array("", "https:", "http:");
$body_url = str_replace($remove, '', $body_font);
$headings_url = str_replace($remove, '', $headings_font);
wp_enqueue_style( 'britt-body-fonts', esc_attr($body_url) );
wp_enqueue_style( 'britt-headings-fonts', esc_attr($headings_url) );
wp_enqueue_script( 'britt-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'britt-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'britt-scripts', get_template_directory_uri() . '/js/scripts.js', array('jquery'), '', true );
wp_enqueue_script( 'britt-main', get_template_directory_uri() . '/js/main.js', array('jquery'), '', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'britt_scripts' );
/**
* Enqueue Bootstrap
*/
function britt_enqueue_bootstrap() {
wp_enqueue_style( 'britt-bootstrap', get_template_directory_uri() . '/css/bootstrap/bootstrap.min.css', array(), true );
}
add_action( 'wp_enqueue_scripts', 'britt_enqueue_bootstrap', 9 );
/**
* Get first post category
*/
function britt_get_first_cat() {
$category = get_the_category();
if ($category) {
echo '' . $category[0]->name.'';
}
}
/**
* Excerpt length
*/
function britt_excerpt_length( $length ) {
$excerpt = get_theme_mod('exc_length', '20');
return $excerpt;
}
add_filter( 'excerpt_length', 'britt_excerpt_length', 999 );
/**
* Excerpt read more
*/
function britt_custom_excerpt( $more ) {
$more = get_theme_mod('custom_read_more');
if ($more == '') {
return ' […]';
} else {
return ' ' . esc_html($more) . '';
}
}
add_filter( 'excerpt_more', 'britt_custom_excerpt' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Styles
*/
require get_template_directory() . '/inc/styles.php';
function britt_posts_carousel() {
$number = get_theme_mod('carousel_posts_no', '4');
$hide = get_theme_mod('hide_carousel_singles', '1');
if ( is_singular() && $hide )
return;
?>
$number,
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true
) );
if ($r->have_posts()) :
while ( $r->have_posts() ) : $r->the_post(); ?>
';
echo '';
the_post_thumbnail('britt-large-thumb');
echo '
';
echo '';
echo '';
}
}
add_action('britt_featured_area', 'britt_featured_image_large');