__( 'Primary Menu', 'brasserie' ),
) );
/**
* Add support for post thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size( 100, 300, true);
add_image_size( 'recent', 670, 400, true );
// link a custom stylesheet file to the TinyMCE visual editor
add_editor_style( array('style.css', 'css/editor-style.css') );
/**
* Add Team role
*/
$result = add_role('team_member', __( 'Team Member', 'brasserie' ), array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => false, // Use false to explicitly deny
));
/**
* Add support for the Aside Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', ) );
// Display Title in theme
add_theme_support( 'title-tag' );
// link a custom stylesheet file to the TinyMCE visual editor
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Open+Sans' );
add_editor_style( array('style.css', 'css/editor-style.css', $font_url) );
}
endif; // brasserie_setup
add_action( 'after_setup_theme', 'brasserie_setup' );
/**
* Setup the WordPress core custom background feature.
*
* Use add_theme_support to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* Hooks into the after_setup_theme action.
*
* @since brasserie 1.0
*/
function brasserie_register_custom_background() {
$args = array(
'default-color' => 'EEE',
);
$args = apply_filters( 'brasserie_custom_background_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-background', $args );
} else {
define( 'BACKGROUND_COLOR', $args['default-color'] );
define( 'BACKGROUND_IMAGE', $args['default-image'] );
add_theme_support( 'custom-background', $args );
}
}
add_action( 'after_setup_theme', 'brasserie_register_custom_background' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since brasserie 1.0
*/
function brasserie_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'brasserie' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'brasserie' ),
'id' => 'sidebar-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Left Sidebar', 'brasserie' ),
'id' => 'sidebar-3',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar(array(
'name' => __( 'Left Footer Column', 'brasserie' ),
'id' => 'left_column',
'description' => __( 'Widget area for footer left column', 'brasserie' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => __( 'Center Footer Column', 'brasserie' ),
'id' => 'center_column',
'description' => __( 'Widget area for footer center column', 'brasserie' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => __( 'Right Footer Column', 'brasserie' ),
'id' => 'right_column',
'description' => __( 'Widget area for footer right column', 'brasserie' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
}
add_action( 'widgets_init', 'brasserie_widgets_init' );
/**
* Customizer additions
*/
require( get_template_directory() . '/inc/customizer.php' );
/**
* Enqueue scripts and styles
*/
function brasserie_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri(), '' ,rand() );
wp_enqueue_style('font-awesome', get_template_directory_uri().'/css/font-awesome.min.css');
wp_enqueue_style('animate', get_template_directory_uri() . '/css/animate.min.css');
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
if (!is_admin()) {
wp_enqueue_script( 'tooltipsy', get_template_directory_uri() . '/js/tooltipsy.js', array( 'jquery' ), '20120208', true );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
wp_enqueue_script( 'smoothup', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'inview', get_template_directory_uri() . '/js/inview.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array( 'jquery'), '', true );
}
// Implement brasserie homepage Flexsliders
if (is_page_template( 'page-templates/custom_home.php' )) {
wp_enqueue_script('flexslider', get_template_directory_uri().'/js/jquery.flexslider-min.js', array('jquery'));
wp_enqueue_script('flexslider-init', get_template_directory_uri().'/js/flexslider-init.js', array('jquery', 'flexslider'));
wp_enqueue_style('flexslider', get_template_directory_uri().'/css/flexslider.css', '', rand());
}
}
add_action( 'wp_enqueue_scripts', 'brasserie_scripts' );
/**
* Implement excerpt for homepage slider
*/
function brasserie_get_slider_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 120);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
return $excerpt;
}
/**
* Implement excerpt for homepage recent posts
*/
function brasserie_get_recentposts_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 100);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
return $excerpt;
}
/**
* Implement excerpt for homepage thumbnails
*/
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
/**
* Social Media Links on Contributors template
*/
function author_social_media( $socialmedialinks ) {
$socialmedialinks['google_profile'] = 'Google+ URL';
$socialmedialinks['twitter_profile'] = 'Twitter URL';
$socialmedialinks['instagram_profile'] = 'Instagram URL';
$socialmedialinks['facebook_profile'] = 'Facebook URL';
$socialmedialinks['linkedin_profile'] = 'Linkedin URL';
return $socialmedialinks;
}
add_filter( 'user_contactmethods', 'author_social_media', 10, 1);
/**
* Custom "more" link format
*/
function new_excerpt_more($more) {
global $post;
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
/**
* Implement the Custom Header feature
*/
add_theme_support( 'custom-header' );
function brasserie_custom_header_setup() {
$args = array(
'default-image' => '',
'default-text-color' => '222',
'width' => 1700,
'height' => 500,
'flex-height' => true,
'wp-head-callback' => 'brasserie_header_style',
'admin-head-callback' => 'brasserie_admin_header_style',
'admin-preview-callback' => 'brasserie_admin_header_image',
);
$args = apply_filters( 'brasserie_custom_header_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-header', $args );
}
}
add_action( 'after_setup_theme', 'brasserie_custom_header_setup' );
if ( ! function_exists( 'brasserie_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @see brasserie_custom_header_setup().
*
* @since brasserie 1.0
*/
function brasserie_header_style() {
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
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.
*
* @see brasserie_custom_header_setup().
*
* @since brasserie 1.0
*/
function brasserie_admin_header_style() {
?>
Header admin panel.
*
* @see brasserie_custom_header_setup().
*
* @since brasserie 1.0
*/
function brasserie_admin_header_image() { ?>
>