__( 'Primary Menu', 'automobile' ), 'header-top' => __( 'Header Top Menu', 'automobile' ), 'header-right' => __( 'Header Right Menu', 'automobile' ), ) ); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); /** * Setup the WordPress core custom background feature. */ $default_options = automobile_get_default_theme_options(); //Get Default Theme Options Values $default_bg_color = $default_options['background_color']; add_theme_support( 'custom-background', apply_filters( 'automobile_custom_background_args', array( 'default-color' => $default_bg_color ) ) ); /** * Setup Editor style */ add_editor_style( 'css/editor-style.css' ); /** * Setup title support for theme * Supported from WordPress version 4.1 onwards * More Info: https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ */ add_theme_support( 'title-tag' ); /** * Setup Custom Logo Support for theme * Supported from WordPress version 4.5 onwards * More Info: https://make.wordpress.org/core/2016/03/10/custom-logo/ */ add_theme_support( 'custom-logo' ); /** * Setup Infinite Scroll using JetPack if navigation type is set */ $pagination_type = isset( $options['pagination_type'] ) ? $options['pagination_type'] : ''; if( 'infinite-scroll-click' == $pagination_type ) { add_theme_support( 'infinite-scroll', array( 'type' => 'click', 'container' => 'main', 'footer' => 'page' ) ); } else if ( 'infinite-scroll-scroll' == $pagination_type ) { //Override infinite scroll disable scroll option update_option('infinite_scroll', true); add_theme_support( 'infinite-scroll', array( 'type' => 'scroll', 'container' => 'main', 'footer' => 'page' ) ); } } endif; // automobile_setup add_action( 'after_setup_theme', 'automobile_setup' ); /** * Enqueue scripts and styles * * @uses wp_register_script, wp_enqueue_script, wp_register_style, wp_enqueue_style, wp_localize_script * @action wp_enqueue_scripts * * @since Automobile 0.1 */ function automobile_scripts() { $options = automobile_get_theme_options(); //Used default Google fonts $automobile_fonts = array( 'Oswald', 'Quattrocento' ); $web_fonts_stylesheet = '//fonts.googleapis.com/css?family='; $i = 0; foreach( $automobile_fonts as $automobile_font ) { if( $i )// only set | to $web_fonts_stylesheet from second loop onwards $web_fonts_stylesheet .='%7c'; $web_fonts_stylesheet .= $automobile_font . ':300,300italic,regular,italic,600,600italic'; $i = 1; } $web_fonts_stylesheet .= '&subset=latin'; wp_register_style( 'automobile-web-font', $web_fonts_stylesheet, false, null ); wp_enqueue_style( 'automobile-style', get_stylesheet_uri(), array( 'automobile-web-font' ), CLEAN_MAGAZINE_THEME_VERSION ); wp_enqueue_script( 'automobile-navigation', get_template_directory_uri() . '/js/navigation.min.js', array(), '20120206', true ); wp_enqueue_script( 'automobile-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.min.js', array(), '20130115', true ); /** * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } //For genericons wp_enqueue_style( 'genericons', get_template_directory_uri() . '/css/genericons/genericons.css', false, '3.4.1' ); /** * Loads up Responsive Menu JS and fit vids */ wp_enqueue_script('sidr', get_template_directory_uri() . '/js/jquery.sidr.min.js', array('jquery'), '2.2.1.1', false ); /** * Loads up fit vids */ wp_enqueue_script( 'fitvids', get_template_directory_uri() . '/js/fitvids.min.js', array( 'jquery' ), '1.1', true ); /** * Loads up Cycle JS */ if( $options['featured_slider_option'] != 'disabled' || $options['news_ticker_option'] != 'disabled' ) { wp_register_script( 'jquery.cycle2', get_template_directory_uri() . '/js/jquery.cycle/jquery.cycle2.min.js', array( 'jquery' ), '2.1.5', true ); $transition_effects = array( $options['featured_slide_transition_effect'], $options['news_ticker_transition_effect'] ); /** * Condition checks for additional slider transition plugins */ // Scroll Vertical transition plugin addition if ( in_array( 'scrollVert', $transition_effects ) ){ wp_enqueue_script( 'jquery.cycle2.scrollVert', get_template_directory_uri() . '/js/jquery.cycle/jquery.cycle2.scrollVert.min.js', array( 'jquery.cycle2' ), '20140128', true ); } // Flip transition plugin addition if ( in_array( 'flipHorz', $transition_effects ) || in_array( 'flipVert', $transition_effects ) ){ wp_enqueue_script( 'jquery.cycle2.flip', get_template_directory_uri() . '/js/jquery.cycle/jquery.cycle2.flip.min.js', array( 'jquery.cycle2' ), '20140128', true ); } // Suffle transition plugin addition if ( in_array( 'tileSlide', $transition_effects ) || in_array( 'tileBlind', $transition_effects ) ){ wp_enqueue_script( 'jquery.cycle2.tile', get_template_directory_uri() . '/js/jquery.cycle/jquery.cycle2.tile.min.js', array( 'jquery.cycle2' ), '20140128', true ); } // Suffle transition plugin addition if ( in_array( 'shuffle', $transition_effects ) ){ wp_enqueue_script( 'jquery.cycle2.shuffle', get_template_directory_uri() . '/js/jquery.cycle/jquery.cycle2.shuffle.min.js', array( 'jquery.cycle2' ), '20140128 ', true ); } //Load jquery cycle alone if no plugin is required if ( !( in_array( 'scrollVert', $transition_effects ) || in_array( 'flipHorz', $transition_effects ) || in_array( 'flipVert', $transition_effects ) || in_array( 'tileSlide', $transition_effects ) || in_array( 'tileBlind', $transition_effects ) || in_array( 'shuffle', $transition_effects ) ) ){ wp_enqueue_script( 'jquery.cycle2' ); } } /** * Loads up Scroll Up script */ if ( ! $options['disable_scrollup'] ) { wp_enqueue_script( 'automobile-scrollup', get_template_directory_uri() . '/js/scrollup.min.js', array( 'jquery' ), '20072014', true ); } /** * Enqueue custom script for Automobile. */ wp_enqueue_script( 'automobile-custom-scripts', get_template_directory_uri() . '/js/custom-scripts.min.js', array( 'jquery' ), null ); } add_action( 'wp_enqueue_scripts', 'automobile_scripts' ); /** * Enqueue scripts and styles for Metaboxes * @uses wp_register_script, wp_enqueue_script, and wp_enqueue_style * * @action admin_print_scripts-post-new, admin_print_scripts-post, admin_print_scripts-page-new, admin_print_scripts-page * * @since Automobile 0.1 */ function automobile_enqueue_metabox_scripts() { //Scripts wp_enqueue_script( 'automobile-metabox', get_template_directory_uri() . '/js/automobilemetabox.min.js', array( 'jquery', 'jquery-ui-tabs' ), '2013-10-05' ); //CSS Styles wp_enqueue_style( 'automobile-metabox-tabs', get_template_directory_uri() . '/css/metabox-tabs.css' ); } add_action( 'admin_print_scripts-post-new.php', 'automobile_enqueue_metabox_scripts', 11 ); add_action( 'admin_print_scripts-post.php', 'automobile_enqueue_metabox_scripts', 11 ); add_action( 'admin_print_scripts-page-new.php', 'automobile_enqueue_metabox_scripts', 11 ); add_action( 'admin_print_scripts-page.php', 'automobile_enqueue_metabox_scripts', 11 ); /** * Default Options. */ require get_template_directory() . '/inc/default-options.php'; /** * Custom Header. */ require get_template_directory() . '/inc/custom-header.php'; /** * Structure for Automobile */ require get_template_directory() . '/inc/structure.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer-includes/customizer.php'; /** * Custom Menus */ require get_template_directory() . '/inc/menus.php'; /** * Load Header Highlight Content file. */ require get_template_directory() . '/inc/header-highlight-content.php'; /** * Load Slider file. */ require get_template_directory() . '/inc/featured-slider.php'; /** * Load Featured Content. */ require get_template_directory() . '/inc/featured-content.php'; /** * News Ticker */ require get_template_directory() . '/inc/news-ticker.php'; /** * Load Breadcrumb file. */ require get_template_directory() . '/inc/breadcrumb.php'; /** * Load Widgets and Sidebars */ require get_template_directory() . '/inc/widgets/widgets.php'; /** * Load Social Icons */ require get_template_directory() . '/inc/social-icons.php'; /** * Load Metaboxes */ require get_template_directory() . '/inc/metabox.php'; /** * Returns the options array for Automobile. * @uses get_theme_mod * * @since Automobile 0.1 */ function automobile_get_theme_options() { $automobile_default_options = automobile_get_default_theme_options(); return array_merge( $automobile_default_options , get_theme_mod( 'automobile_theme_options', $automobile_default_options ) ) ; } /** * Flush out all transients * * @uses delete_transient * * @action customize_save, automobile_customize_preview (see automobile_customizer function: automobile_customize_preview) * * @since Automobile 0.1 */ function automobile_flush_transients(){ delete_transient( 'automobile_header_highlight_content' ); delete_transient( 'automobile_featured_content' ); delete_transient( 'automobile_news_ticker' ); delete_transient( 'automobile_featured_slider' ); delete_transient( 'automobile_custom_css' ); delete_transient( 'automobile_footer_content' ); delete_transient( 'automobile_featured_image' ); delete_transient( 'automobile_social_icons' ); delete_transient( 'automobile_scrollup' ); delete_transient( 'all_the_cool_cats' ); //Add Automobile default themes if there is no values if ( !get_theme_mod('automobile_theme_options') ) { set_theme_mod( 'automobile_theme_options', automobile_get_default_theme_options() ); } } add_action( 'customize_save', 'automobile_flush_transients' ); /** * Flush out category transients * * @uses delete_transient * * @action edit_category * * @since Automobile 0.1 */ function automobile_flush_category_transients(){ delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'automobile_flush_category_transients' ); /** * Flush out post related transients * * @uses delete_transient * * @action save_post * * @since Automobile 0.1 */ function automobile_flush_post_transients(){ delete_transient( 'automobile_featured_content' ); delete_transient( 'automobile_news_ticker' ); delete_transient( 'automobile_featured_slider' ); delete_transient( 'automobile_featured_image' ); delete_transient( 'all_the_cool_cats' ); } add_action( 'save_post', 'automobile_flush_post_transients' ); if ( ! function_exists( 'automobile_custom_css' ) ) : /** * Enqueue Custon CSS * * @uses set_transient, wp_head, wp_enqueue_style * * @action wp_enqueue_scripts * * @since Automobile 0.1 */ function automobile_custom_css() { //automobile_flush_transients(); $options = automobile_get_theme_options(); $defaults = automobile_get_default_theme_options(); if ( ( !$automobile_custom_css = get_transient( 'automobile_custom_css' ) ) ) { $automobile_custom_css =''; $text_color = get_header_textcolor(); if ( 'blank' == $text_color ){ $automobile_custom_css .= ".site-title a, .site-description { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); }". "\n"; } elseif ( HEADER_TEXTCOLOR != $text_color ) { $automobile_custom_css .= ".site-title a, .site-description { color: #". $text_color ."; }". "\n"; } //Custom CSS Option if( !empty( $options[ 'custom_css' ] ) ) { $automobile_custom_css .= $options[ 'custom_css'] . "\n"; } if ( '' != $automobile_custom_css ){ echo '' . "\n"; $automobile_custom_css = '' . "\n" . '' . "\n"; } set_transient( 'automobile_custom_css', htmlspecialchars_decode( $automobile_custom_css ), 86940 ); } echo $automobile_custom_css; } endif; //automobile_custom_css add_action( 'wp_head', 'automobile_custom_css', 101 ); /** * Alter the query for the main loop in homepage * * @action pre_get_posts * * @since Automobile 0.1 */ function automobile_alter_home( $query ){ $options = automobile_get_theme_options(); $cats = $options[ 'front_page_category' ]; if ( is_array( $cats ) && !in_array( '0', $cats ) ) { if( $query->is_main_query() && $query->is_home() ) { $query->query_vars['category__in'] = $cats; } } } add_action( 'pre_get_posts','automobile_alter_home' ); if ( ! function_exists( 'automobile_content_nav' ) ) : /** * Display navigation to next/previous pages when applicable * * @since Automobile 0.1 */ function automobile_content_nav( $nav_id ) { global $wp_query, $post; // Don't print empty markup on single pages if there's nowhere to navigate. if ( is_single() ) { $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) { return; } $options = automobile_get_theme_options(); $pagination_type = $options['pagination_type']; $nav_class = ( is_single() ) ? 'site-navigation post-navigation' : 'site-navigation paging-navigation'; /** * Check if navigation type is Jetpack Infinite Scroll and if it is enabled, else goto default pagination * if it's active then disable pagination */ if ( ( 'infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type ) && class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' ) ) { return false; } ?> comment_type || 'trackback' == $comment->comment_type ) : ?>