__( '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' );
// Support for Woocommerce
add_theme_support( 'woocommerce' );
// 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' => __( 'Shop Sidebar', 'brasserie' ),
'id' => 'woocommerce_sidebar',
'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', 'imagesloaded', 'masonry'), '', 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');
/**
* Pro Link
*/
function brasserie_get_pro_link( $content ) {
return esc_url( 'https://www.templateexpress.com/brasseriepro-theme' );
}
/**
* 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() { ?>
>
cart->cart_contents_count, 'brasserie'), $woocommerce->cart->cart_contents_count);?> - cart->get_cart_total(); ?>
'Restaurant Reservations',
'slug' => 'restaurant-reservations',
'required' => false,
),
array(
'name' => 'Food And Drink Menu',
'slug' => 'food-and-drink-menu',
'required' => false,
),
);
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'brasserie', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
/*
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'brasserie' ),
'menu_title' => __( 'Install Plugins', 'brasserie' ),
/* translators: %s: plugin name. * /
'installing' => __( 'Installing Plugin: %s', 'brasserie' ),
/* translators: %s: plugin name. * /
'updating' => __( 'Updating Plugin: %s', 'brasserie' ),
'oops' => __( 'Something went wrong with the plugin API.', 'brasserie' ),
'notice_can_install_required' => _n_noop(
/* translators: 1: plugin name(s). * /
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'brasserie'
),
'notice_can_install_recommended' => _n_noop(
/* translators: 1: plugin name(s). * /
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'brasserie'
),
'notice_ask_to_update' => _n_noop(
/* translators: 1: plugin name(s). * /
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'brasserie'
),
'notice_ask_to_update_maybe' => _n_noop(
/* translators: 1: plugin name(s). * /
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'brasserie'
),
'notice_can_activate_required' => _n_noop(
/* translators: 1: plugin name(s). * /
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'brasserie'
),
'notice_can_activate_recommended' => _n_noop(
/* translators: 1: plugin name(s). * /
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'brasserie'
),
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'brasserie'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'brasserie'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'brasserie'
),
'return' => __( 'Return to Required Plugins Installer', 'brasserie' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'brasserie' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'brasserie' ),
/* translators: 1: plugin name. * /
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'brasserie' ),
/* translators: 1: plugin name. * /
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'brasserie' ),
/* translators: 1: dashboard link. * /
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'brasserie' ),
'dismiss' => __( 'Dismiss this notice', 'brasserie' ),
'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'brasserie' ),
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'brasserie' ),
'nag_type' => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions.
),
*/
);
tgmpa( $plugins, $config );
}