__('Primary Menu', 'bravo'),
'footer' => __('Footer Menu', 'bravo')
));
add_theme_support('post-thumbnails');
add_theme_support('html5', array('search-form'));
add_theme_support('automatic-feed-links');
add_image_size('featured', 725);
add_image_size('featured-cropped', 725, 350, true);
add_editor_style( get_template_directory_uri() . '/assets/css/editor-style.css');
}
endif;
add_action('after_setup_theme', 'bravo_setup');
// register google fonts
if (!function_exists('bravo_fonts_url')) :
function bravo_fonts_url() {
$fonts_url = '';
$lobster = _x('on', 'Lobster font: on or off', 'bravo');
$raleway = _x('on', 'Raleway font: on or off', 'bravo');
if ('off' !== $lobster || 'off' !== $raleway) {
$font_families = array();
if ('off' !== $lobster) {
$font_families[] = 'Lobster';
}
if ('off' !== $raleway) {
$font_families[] = 'Raleway:400,700';
}
$query_args = array(
'family' => urlencode(implode('|', $font_families)),
'subset' => urlencode('latin,latin-ext'),
);
$fonts_url = add_query_arg($query_args, '//fonts.googleapis.com/css');
}
return $fonts_url;
}
endif;
// load css
function bravo_css() {
wp_enqueue_style('bravo_fonts', bravo_fonts_url(), array(), null);
wp_enqueue_style('bravo_bootstrap_css', get_template_directory_uri() . '/assets/css/bootstrap.min.css');
wp_enqueue_style('bravo_style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'bravo_css');
// load javascript
function bravo_javascript() {
wp_enqueue_script('bravo_script', get_template_directory_uri() . '/assets/js/bravo.js', array('jquery'), '1.0', true);
if (is_singular() && comments_open()) {wp_enqueue_script('comment-reply');}
}
add_action('wp_enqueue_scripts', 'bravo_javascript');
// html5 shiv
function bravo_html5_shiv() {
echo '';
}
add_action('wp_head', 'bravo_html5_shiv');
// sidebar
function bravo_widgets_init() {
register_sidebar(array(
'name' => __('Primary Sidebar', 'bravo'),
'id' => 'primary-sidebar',
'description' => __('Widgets in this area will appear in the right sidebar on all pages and posts.', 'bravo'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
'
));
}
add_action('widgets_init', 'bravo_widgets_init');
// page titles
if (!function_exists('bravo_title')):
function bravo_title($title, $sep) {
global $paged, $page;
if (is_feed()) {
return $title;
}
$title .= get_bloginfo('name');
$site_description = get_bloginfo('description', 'display');
if ( $site_description && (is_home() || is_front_page())) {
$title = "$title $sep $site_description";
}
if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __('Page %s', 'bravo'), max($paged, $page));
}
return $title;
}
add_filter('wp_title', 'bravo_title', 10, 2);
endif;
// custom excerpt
function bravo_custom_excerpt_length($length) {
return 35;
}
add_filter('excerpt_length', 'bravo_custom_excerpt_length', 999);
if (!function_exists('bravo_custom_excerpt_more') && !is_admin()) :
function bravo_custom_excerpt_more($more) {
global $post;
return '...'. __('Read More', 'bravo') .'
';
}
add_filter('excerpt_more', 'bravo_custom_excerpt_more');
endif;
// pagination
if (!function_exists('bravo_pagination')):
function bravo_pagination() {
global $wp_query;
$big = 999999999;
echo '';
echo paginate_links( array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'prev_next' => False,
));
echo '
';
}
endif;
// comments
if (!function_exists('bravo_comment')) :
function bravo_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
id="li-comment-">
add_section(
'header_hero',
array(
'title' => 'Header Hero Content',
'description' => 'Heading, text & link that appears above the content on all posts & pages.',
'priority' => 900,
)
);
$wp_customize->add_setting('hero_heading', array(
'sanitize_callback' => 'bravo_sanitize_text'
));
$wp_customize->add_control(
'hero_heading',
array(
'label' => 'Heading',
'section' => 'header_hero',
'type' => 'text',
)
);
class Customize_Textarea_Control extends WP_Customize_Control {
public $type = 'textarea';
public function render_content() {
?>
add_setting('hero_text', array(
'sanitize_callback' => 'bravo_sanitize_text'
));
$wp_customize->add_control(new Customize_Textarea_Control($wp_customize, 'hero_text', array(
'label' => 'Text',
'section' => 'header_hero',
'settings' => 'hero_text',
)));
$wp_customize->add_setting('hero_url_text', array(
'sanitize_callback' => 'bravo_sanitize_text'
));
$wp_customize->add_control(
'hero_url_text',
array(
'label' => 'Button Text',
'section' => 'header_hero',
'type' => 'text',
)
);
$wp_customize->add_setting('hero_url', array(
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control(
'hero_url',
array(
'label' => 'Button URL',
'section' => 'header_hero',
'type' => 'text',
)
);
function bravo_sanitize_text($input) {
return wp_kses_post(force_balance_tags($input));
}
}
add_action('customize_register', 'bravo_customize_register');
?>