__( 'Primary Menu', 'brawny' ),
) );
/*
* 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',
) );
/*
* Add Additional image sizes
*
*/
add_image_size( 'brawny_home_page_img', 360, 220, true );
add_image_size( 'brawny-blog-full-width', 1200,350, true );
add_image_size( 'brawny-small-featured-image-width', 450,300, true );
add_image_size( 'brawny-blog-large-width', 800,300, true );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
}
endif; // brawny_setup
add_action( 'after_setup_theme', 'brawny_setup' );
add_action( 'after_setup_theme', 'brawny_customizer_setup',11 );
if( ! function_exists( 'brawny_customizer_setup' ) ) {
//echo '', print_r($brawny), '
';
function brawny_customizer_setup() {
if( count( get_theme_mods() ) <= 1 ) {
global $options;
$brawny = get_option('brawny');
foreach($options['panels']['theme_options']['sections'] as $section) {
foreach( $section['fields'] as $name => $settings ) {
//echo 'Name: ' . $name . '
' . 'Value: ' . $brawny[$name] . '
';
if( ! get_theme_mod( $name ) && isset( $brawny[$name] ) ) {
if( is_array( $brawny[$name] ) ) {
set_theme_mod( $name, $brawny[$name]['url'] );
} else {
set_theme_mod( $name, $brawny[$name] );
}
}
}
}
foreach($options['panels']['home']['sections'] as $section) {
foreach( $section['fields'] as $name => $settings ) {
if( ! get_theme_mod( $name ) && isset( $brawny[$name] ) ) {
if( is_array($brawny[$name]) ) {
set_theme_mod( $name, $brawny[$name]['url'] );
}
else {
set_theme_mod( $name, $brawny[$name] );
}
}
if ( isset ( $brawny['slides'] ) ) {
$slide_count = 1;
foreach($brawny['slides'] as $slide) {
if( ! get_theme_mod( 'image_upload-' . $slide_count ) && isset( $slide['image'] ) ) {
set_theme_mod( 'image_upload-' . $slide_count, $slide['image']);
}
if( ! get_theme_mod( 'flexcaption-' . $slide_count ) && isset( $slide['description'] ) ) {
set_theme_mod( 'flexcaption-' . $slide_count, $slide['description']);
}
$slide_count++;
}
}
}
}
}
}
}
/**
* Constants
*/
/* Defining directory PATH Constants */
define( 'BRAWNY_PARENT_DIR', get_template_directory() );
define( 'BRAWNY_CHILD_DIR', get_stylesheet_directory() );
define( 'BRAWNY_INCLUDES_DIR', BRAWNY_PARENT_DIR. '/includes' );
/** Defining URL Constants */
define( 'BRAWNY_PARENT_URL', get_template_directory_uri() );
define( 'BRAWNY_CHILD_URL', get_stylesheet_directory_uri() );
define( 'BRAWNY_INCLUDES_URL', BRAWNY_PARENT_URL . '/includes' );
/*
Check for language directory setup in Child Theme
If not present, use parent theme's languages dir
*/
if ( ! defined( 'BRAWNY_LANGUAGES_URL' ) ) /** So we can predefine to child theme */
define( 'BRAWNY_LANGUAGES_URL', BRAWNY_PARENT_URL . '/languages' );
if ( ! defined( 'BRAWNY_LANGUAGES_DIR' ) ) /** So we can predefine to child theme */
define( 'BRAWNY_LANGUAGES_DIR', BRAWNY_PARENT_DIR . '/languages' );
/**
* Load Theme Options Panel
*/
require get_template_directory() . '/includes/theme-options.php';
/**
* Enqueue Scripts and Styles
*/
require_once BRAWNY_INCLUDES_DIR . '/enqueue.php';
/**
* Custom template tags for this theme.
*/
require BRAWNY_INCLUDES_DIR . '/template-tags.php';
/**
* Customizer Setup
*/
require BRAWNY_INCLUDES_DIR . '/customizer.php';
/**
* Custom functions that act independently of the theme templates.
*/
require BRAWNY_INCLUDES_DIR . '/extras.php';
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function brawny_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'brawny' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Header Top Right', 'brawny' ),
'id' => 'header-top-right',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Nav', 'brawny' ),
'id' => 'footer-nav',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
$footer_widget_args = array(
'name' => __( 'Footer %d', 'brawny' ),
'id' => 'footer',
'description' => '',
'before_widget' => '',
'before_title' => '',
);
register_sidebars(4, $footer_widget_args);
}
add_action( 'widgets_init', 'brawny_widgets_init' );
/**
* Load Jigoshop Support
*/
require_once BRAWNY_INCLUDES_DIR . '/jigoshop.php';
function brawny_slide_exists() {
for ( $slide = 1; $slide < 6; $slide++) {
$url = get_theme_mod( 'image_upload-' .$slide );
$caption = get_theme_mod( 'flexcaption-' .$slide );
if ( $url || $caption ) {
return true;
}
}
return false;
}