function bear_bones_theme_support() { //Most filters have a corresponding function. //Textdomain load_theme_textdomain('bear-bones', get_template_directory() . '/languages'); //MENU register_nav_menus(array('main-menu' => __('Main Menu', 'bear-bones'), 'menu-social' => __('Social Menu', 'bear-bones'))); /*/HEADER */ $args = array('default-image' => get_template_directory_uri() . '/images/header.jpg', 'default-text-color' => '', 'flex-height' => true, 'flex-width' => true, 'header-text' => true, 'height' => 'auto', 'width' => 'auto'); add_theme_support('custom-header', $args); // This theme supports a variety of post formats. add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat')); // allows the use of HTML5 markup add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption')); //@TODO: Add structured theme support /*add_theme_support( 'structured-post-formats', array( 'link', 'video' ) ); add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'quote', 'status' ) );*/ add_theme_support('custom-background'); add_theme_support('automatic-feed-links'); // https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ add_theme_support('title-tag'); /************* THUMBNAIL SIZE OPTIONS *************/ add_theme_support('post-thumbnails'); // default thumb size // Thumbnail sizes bb_featured_image(); //includes/posts.php //BASIC THEME SETUP //Add class="thumbnail" to attachment items add_filter('wp_get_attachment_link', 'bb_attachment_link_class', 10, 1); //Don't return the default description in the RSS feed if it hasn't been changed add_filter('get_bloginfo_rss', 'bb_remove_default_description'); //Remove unnecessary self-closing tags for valid HTML5 add_filter('get_avatar', 'bb_remove_self_closing_tags'); // <img /> add_filter('comment_id_fields', 'bb_remove_self_closing_tags'); // <input /> add_filter('post_thumbnail_html', 'bb_remove_self_closing_tags'); // <img /> //Allow more tags in TinyMCE including <iframe> and <script> add_filter('tiny_mce_before_init', 'bb_change_mce_options'); //Cleanup output of stylesheet <link> tags add_filter('style_loader_tag', 'bb_clean_style_tag'); //Wrap embedded media as suggested by Readability add_filter('embed_oembed_html', 'bb_embed_wrap', 10, 4); add_filter('embed_googlevideo', 'bb_embed_wrap', 10, 2); //Add numbers and next/previous links with wp_link_pages() add_filter('wp_link_pages_args', 'bb_add_next_and_number'); //Add editor style - normally would be get_stylesheet_uri() but admin override available so custom function is used. add_editor_style(array(bb_main_style())); add_filter('request', 'bb_request_filter'); // adding the bear bones search form //add_filter( 'get_search_form', 'bb_wpsearch' ); //RELATED POSTS @TODO: bb_plugin //EXCERPT //add_filter('excerpt_length', 'bb_excerpt_length'); //add_filter('excerpt_more', 'bb_excerpt_more'); //COMMENT LAYOUT //AUTHORS POST LINK @TODO: bb_plugin //Always declare - doesn't hurt add_theme_support('woocommerce'); }
function bear_bones_scripts() { $bb_template_dir = get_template_directory_uri(); //bear bones theme $stylesheet_dir = get_stylesheet_directory_uri(); // child theme if there is one $fileTime = null; $styleFile = '/style.css'; if (is_child_theme()) { //if override style is not selected, then include bear_bones_parent_style if (get_theme_mod('include_parent_style')) { $bbStyleFile = bear_bones_scripts_get_filetime_version($styleFile, get_template_directory()); wp_enqueue_style('bear_bones_parent_style', $bb_template_dir . '/style.css' . $bbStyleFile, null, false); } } wp_enqueue_style('main_style', bb_main_style()); //Include external css files $bb_included_css = get_theme_mod('included_css'); if (isset($bb_included_css)) { $styles = explode(";", $bb_included_css); $i = 1; foreach ($styles as $style) { $style = trim($style); wp_register_style('included_css' . $i, $style, null, null, 'all'); wp_enqueue_style('included_css' . $i); $i++; } } //Check to see if jquery is included in theme $bb_include_jquery = get_theme_mod('bb_include_jquery'); bear_bones_modernizr($bb_template_dir, $stylesheet_dir); /* //Load jquery-ui-tabs include_jquery_ui_tabs, if( get_theme_mod( 'include_jquery_ui_tabs' ) ) { wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-tabs' ); //set jquery to be loaded regardless of theme setting $bb_include_jquery = true; } //Load jquery-ui-tabs include_jquery_ui_tabs, if( get_theme_mod( 'include_jquery_ui_accordion' ) ) { wp_enqueue_script( 'jquery-ui-core' ); //wp_enqueue_script( 'jquery-ui-tabs' ); //set jquery to be loaded regardless of theme setting $bb_include_jquery = true; wp_enqueue_script('jquery-ui-accordion'); } //Load jquery if required. Use enqueue so as not to conflict with other plugins that call it, too //Please, please, please don't call jQuery from a CDN or deregister the script and enqueue a different version //If you do, you will probably have massive amounts of problems with plugins on your website! if(isset($bb_include_jquery)) { wp_enqueue_script('jquery'); } //Load extra js scripts $bb_custom_js_scripts = get_theme_mod( 'included_js_scripts' ); if( isset( $bb_custom_js_scripts ) && $bb_custom_js_scripts != '' ) { $scripts = explode( ";" , $bb_custom_js_scripts ); $i = 1; foreach($scripts as $script) { $script = trim($script); //check for external script if(strpos($script, '//')) { wp_register_script( 'included_js' . $i, $script ); wp_enqueue_script ( 'included_js' . $i, $script, null, null, true ); //if not external then load relative to the stylesheet directory } else { $path_parts = pathinfo($script); wp_register_script( $path_parts['filename'], $stylesheet_dir . $script ); wp_enqueue_script ( $path_parts['filename'], $stylesheet_dir . $script, null, null, true ); } $i++; } } bb_local_script( 'custom' ); $bb_custom_css = get_theme_mod( 'custom_css' ); if(isset($bb_custom_css)) { wp_add_inline_style( 'custom_css', $bb_custom_css ); } if( get_theme_mod( 'background_image' ) ) { wp_add_inline_style( 'background_image', bb_custom_background_size() ); } */ }