__( '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_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', ) ); add_theme_support( 'custom-background' ); add_theme_support( 'custom-logo' ); /* * Add Additional image sizes * */ add_image_size( 'brawny_home_page_img', 360, 220, true ); add_theme_support( 'post-thumbnails' ); add_image_size( 'brawny_recent-post-img', 380, 350, true); add_image_size( 'brawny_service-img', 100, 100, 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 ); add_image_size( 'brawny-thumbnail-large', 400,200, true ); add_image_size( 'brawny-thumbnail-small', 130,90, 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' ); add_editor_style( 'css/editor-style.css' ); // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( // Put two core-defined widgets in the footer 2 area. 'header-top-right' => array( // Widget ID 'my_text' => array( // Widget $id -> set when creating a Widget Class 'text' , // Widget $instance -> settings array( 'text' => '<ul><li><a class="waves-effect waves-light rippler rippler-default" href="http://www.facebook.com/"><i class="fa fa-facebook"></i></a></li><li><a class="waves-effect waves-light rippler rippler-default" href="http://plus.google.com/"><i class="fa fa-google-plus"></i></a></li><li><a class="waves-effect waves-light rippler rippler-default" href="http://www.instagram.com/"><i class="fa fa-instagram"></i></a></li><li><a class="waves-effect waves-light rippler rippler-default" href="http://www.linkedin.com/"><i class="fa fa-linkedin"></i></a></li><li><a class="waves-effect waves-light rippler rippler-default" href="http://www.twitter.com/"><i class="fa fa-twitter"></i></a></li></ul>' ) ), ), 'footer' => array( // Widget ID 'my_text' => array( // Widget $id -> set when creating a Widget Class 'text' , // Widget $instance -> settings array( 'title' => 'About Brawny', 'text' => 'Lorem ipsum adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enimquis nostrud exercitation ullamco laboris nisi ut aliquip consequat. Duis aute irure dolor in reprehenderit in volup cillum dolore pariatur.' ) ) ), 'footer-2' => array( // Widget ID 'recent-posts' ), 'footer-3' => array( // Widget ID 'meta' ), 'footer-4' => array( // Widget ID 'my_text' => array( // Widget $id -> set when creating a Widget Class 'text' , // Widget $instance -> settings array( 'title' => 'Contact Us', 'text' => '<div class="footer-contact"><p> Po Box CT16122 Colin Street West, Australia </p><p><i class="fa fa-phone"></i> +123 456 7890</p><p><i class="fa fa-fax"></i> 03 5481 2221</p><p><i class="fa fa-envelope"></i> <a href="mailto:info@gmail.com">info@gmail.com</a></p></div>' ) ) ), ), // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'home' => array( 'post_type' => 'page', ), 'blog' => array( 'post_type' => 'page', ), /*'post-one' => array( 'post_type' => 'post', 'post_title' => __( 'Post One', 'brawny'), 'post_content' => sprintf( __('<h1> Slider Setting </h1><p>You haven\'t created any slider yet. Create a post, set your slider image as Post\'s featured image ( Recommended image size 1280*450 ) ). Go to Customizer and click brawny Options => Home and select Slider Post Category and No.of Sliders.<p><a href="%1$s"target="_blank"> Customizer </a></p>', 'brawny'), admin_url('customize.php') ), 'thumbnail' => '{{post-featured-image}}', ), 'post-two' => array( 'post_type' => 'post', 'post_title' => __( 'Post Two', 'brawny'), 'post_content' => sprintf( __('<h1> Slider Setting </h1><p>You haven\'t created any slider yet. Create a post, set your slider image as Post\'s featured image ( Recommended image size 1280*450 ) ). Go to Customizer and click brawny Options => Home and select Slider Post Category and No.of Sliders.<p><a href="%1$s"target="_blank"> Customizer </a></p>', 'brawny'), admin_url('customize.php') ), 'thumbnail' => '{{post-featured-image}}', ), 'service-one' => array( 'post_type' => 'page', 'post_title' => __( 'Responsive Layout', 'brawny'), 'post_content' => sprintf( __('You haven\'t created any service page yet. Create Page. Go to <a href="%1$s"target="_blank"> Customizer </a> and click brawny Options => Home => Service Section #1 and select page from dropdown page list.','brawny'), admin_url('customize.php') ), 'thumbnail' => '{{page-images}}', ), 'service-two' => array( 'post_type' => 'page', 'post_title' => __( 'Awesome Slider', 'brawny'), 'post_content' => sprintf( __('You haven\'t created any service page yet. Create Page. Go to <a href="%1$s"target="_blank"> Customizer </a> and click brawny Options => Home => Service Section #1 and select page from dropdown page list.','brawny'), admin_url('customize.php') ), 'thumbnail' => '{{page-images}}', ), 'service-three' => array( 'post_type' => 'page', 'post_title' => __( 'Fully Customizable', 'brawny'), 'post_content' => sprintf( __('You haven\'t created any service page yet. Create Page. Go to <a href="%1$s"target="_blank"> Customizer </a> and click brawny Options => Home => Service Section #1 and select page from dropdown page list.','brawny'), admin_url('customize.php') ), 'thumbnail' => '{{page-images}}', ), */ ), // Create the custom image attachments used as post thumbnails for pages. /*'attachments' => array( 'post-featured-image' => array( 'post_title' => __( 'slider one', 'brawny' ), 'file' => 'images/slider.png', // URL relative to the template directory. ), 'page-images' => array( 'post_title' => __( 'Page Images', 'brawny' ), 'file' => 'images/page.png', // URL relative to the template directory. ), ), */ // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set the front page section theme mods to the IDs of the core-registered pages. 'theme_mods' => array( 'header-top-left' =>'<p><a href="#">Form</a> | <a href="#">Terms</a> | <a href="#">Contact</a> | </p>', 'header-top-right' => '<p><span><i class="fa fa-mobile-phone"></i>123-456-789</span> <span><i class="fa fa-envelope-o"></i><a href="mailto:info@brawny.com">info@brawny.com</a></span></p>' /*'slider_cat' => '1', 'service_1' => '{{service-one}}', 'service_2' => '{{service-two}}', 'service_3' => '{{service-three}}', */ ), ); $starter_content = apply_filters( 'brawny_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } 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 '<pre>', print_r($brawny), '</pre>'; function brawny_customizer_setup() { $ver = get_theme_mod( 'version', false ); if ( version_compare( $ver, '1.0.0' , '<=' ) && !empty($ver) ) { 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 . '<br>' . 'Value: ' . $brawny[$name] . '<br>'; 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' ); /** * Enqueue Scripts and Styles */ require_once BRAWNY_INCLUDES_DIR . '/enqueue.php'; /** * Custom template tags for this theme. */ require BRAWNY_INCLUDES_DIR . '/template-tags.php'; /** * Free Theme upgrade page */ require get_template_directory() . '/includes/theme_upgrade.php'; require get_template_directory() . '/includes/styles.php'; /** * Load TGM plugin */ require get_template_directory() . '/admin/class-tgm-plugin-activation.php'; /** * Customizer Setup */ require BRAWNY_INCLUDES_DIR . '/customizer.php'; /** * Custom functions that act independently of the theme templates. */ require BRAWNY_INCLUDES_DIR . '/extras.php'; require get_template_directory() . '/includes/custom-header.php'; require get_template_directory() . '/includes/hooks-filters.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' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'Sidebar Left', 'brawny' ), 'id' => 'sidebar-left', 'description' => __( 'Left Sidebar', 'brawny' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'Header Top Right', 'brawny' ), 'id' => 'header-top-right', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'Footer Nav', 'brawny' ), 'id' => 'footer-nav', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); $footer_widget_args = array( 'name' => __( 'Footer %d', 'brawny' ), 'id' => 'footer', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ); 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; } /* Woocommerce support */ add_theme_support('woocommerce'); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper'); add_action('woocommerce_before_main_content', 'brawny_output_content_wrapper'); function brawny_output_content_wrapper() { $woocommerce_sidebar = get_theme_mod('woocommerce_sidebar',true ) ; if( $woocommerce_sidebar ) { $woocommerce_sidebar_column = 'eleven'; }else { $woocommerce_sidebar_column = 'sixteen'; remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar'); } echo '<div class="site-content container" id="content"><div id="primary" class="content-area '. $woocommerce_sidebar_column .' columns">'; } remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' ); add_action( 'woocommerce_after_main_content', 'brawny_output_content_wrapper_end' ); function brawny_output_content_wrapper_end () { echo "</div>"; } add_action( 'init', 'brawny_remove_wc_breadcrumbs' ); function brawny_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } include_once( get_template_directory() . '/admin/theme-options.php' ); /* Recommended plugin using TGM */ add_action( 'tgmpa_register', 'brawny_register_plugins'); if( !function_exists('brawny_register_plugins') ) { function brawny_register_plugins() { /** * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( array( 'name' => 'WPForms Lite', // The plugin name. 'slug' => 'wpforms-lite', // The plugin slug (typically the folder name). 'required' => false, // If false, the plugin is only 'recommended' instead of required. ), ); /* * 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' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'parent_slug' => 'themes.php', // Parent menu slug. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. '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. ); tgmpa( $plugins, $config ); } }