__( 'Primary Menu', 'oxygen' ), 'secondary' => __( 'Secondary Menu', 'oxygen' ), 'tertiary' => __( 'Tertiary Menu', 'oxygen' ), ) ); add_theme_support( 'custom-background', apply_filters( 'oxygen_custom_background_args', array( 'default-color' => 'ffffff' ) ) ); /** * Add theme support for Responsive Videos. */ add_theme_support( 'jetpack-responsive-videos' ); } endif; // oxygen_setup add_action( 'after_setup_theme', 'oxygen_setup' ); /** * Register widgetized area and update sidebar with default widgets * * @since Oxygen 0.2.2 */ function oxygen_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Sidebar', 'oxygen' ), 'id' => 'sidebar-1', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Secondary Sidebar', 'oxygen' ), 'id' => 'sidebar-2', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area One', 'oxygen' ), 'id' => 'sidebar-3', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area Two', 'oxygen' ), 'id' => 'sidebar-4', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area Three', 'oxygen' ), 'id' => 'sidebar-5', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area Four', 'oxygen' ), 'id' => 'sidebar-6', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'After Post', 'oxygen' ), 'id' => 'sidebar-7', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'oxygen_widgets_init' ); /** * Enqueue scripts and styles * * @since Oxygen 0.2.2 */ // Enqueue scripts function oxygen_scripts() { global $post; wp_enqueue_style( 'style', get_stylesheet_uri(), array(), '20120426', 'screen' ); wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.min.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'masonry' ); wp_enqueue_script( 'jquery-imagesloaded', get_template_directory_uri() . '/js/jquery.imagesloaded.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'oxygen-theme', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20120206', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); if ( is_singular() && wp_attachment_is_image( $post->ID ) ) wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } add_action( 'wp_enqueue_scripts', 'oxygen_scripts' ); /** * Register Google fonts styles. */ function oxygen_register_fonts() { wp_register_style( 'font-oswald', "https://fonts.googleapis.com/css?family=Oswald", array(), '20120821' ); wp_register_style( 'font-terminal-dosis', "https://fonts.googleapis.com/css?family=Terminal+Dosis", array(), '20120821' ); wp_register_style( 'font-bitter', "https://fonts.googleapis.com/css?family=Bitter", array(), '20120821' ); wp_register_style( 'font-droid-serif', "https://fonts.googleapis.com/css?family=Droid+Serif:400,400italic", array(), '20120821' ); wp_register_style( 'font-droid-sans', "https://fonts.googleapis.com/css?family=Droid+Sans", array(), '20120821' ); wp_register_style( 'font-abel', "https://fonts.googleapis.com/css?family=Abel", array(), '20120821' ); } add_action( 'init', 'oxygen_register_fonts' ); /** * Enqueue Google fonts styles. * * @since Oxygen 0.2.2 */ function oxygen_fonts() { $options = oxygen_get_theme_options(); $current_font = $options['font']; switch ( $current_font ) { case 'oswald' : wp_enqueue_style( 'font-oswald' ); break; case 'terminal_dosis' : wp_enqueue_style( 'font-terminal-dosis' ); break; case 'bitter' : wp_enqueue_style( 'font-bitter' ); break; case 'droid_serif' : wp_enqueue_style( 'font-droid-serif' ); break; case 'droid_sans' : wp_enqueue_style( 'font-droid-sans' ); default : wp_enqueue_style( 'font-abel' ); } } add_action( 'wp_enqueue_scripts', 'oxygen_fonts' ); /** * Enqueue Google fonts style to admin screen for custom header display * * @since Oxygen 0.2.2 */ function oxygen_admin_fonts( $hook_suffix ) { if ( 'appearance_page_custom-header' != $hook_suffix ) return; $options = oxygen_get_theme_options(); $current_font = $options['font']; switch ( $current_font ) { case 'oswald' : wp_enqueue_style( 'font-oswald' ); break; case 'terminal_dosis' : wp_enqueue_style( 'font-terminal-dosis' ); break; case 'bitter' : wp_enqueue_style( 'font-bitter' ); break; case 'droid_serif' : wp_enqueue_style( 'font-droid-serif' ); break; case 'droid_sans' : wp_enqueue_style( 'font-droid-sans' ); default : wp_enqueue_style( 'font-abel' ); } } add_action( 'admin_enqueue_scripts', 'oxygen_admin_fonts' ); /** * Test to see if any posts meet our conditions for featuring posts * * @since Oxygen 0.2.2 */ function oxygen_featured_posts() { if ( false === ( $featured_post_ids = get_transient( 'featured_post_ids' ) ) ) { // Proceed only if sticky posts exist. $sticky = get_option( 'sticky_posts' ); // Proceed only if sticky posts exist. if ( is_array( $sticky ) && ! empty ( $sticky ) ) { $featured_args = array( 'post__in' => $sticky, 'post_status' => 'publish', 'no_found_rows' => true, 'ignore_sticky_posts' => 1, 'posts_per_page' => 50, ); // The Featured Posts query. $featured = new WP_Query( $featured_args ); // Proceed only if published posts with thumbnails exist if ( $featured->have_posts() ) { while ( $featured->have_posts() ) { $featured->the_post(); if ( get_the_post_thumbnail() ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $featured->post->ID ), 'featured-thumbnail' ); if ( $image[1] >= 750 ) { $featured_post_ids[] = $featured->post->ID; } } } set_transient( 'featured_post_ids', $featured_post_ids ); } wp_reset_postdata(); } } return $featured_post_ids; } /** * Flush out the transients used in oxygen_featured_posts() * * @since Oxygen 0.2.2 */ function oxygen_featured_post_checker_flusher() { // Vvwooshh! delete_transient( 'featured_post_ids' ); } add_action( 'update_option_sticky_posts', 'oxygen_featured_post_checker_flusher' ); add_action( 'save_post', 'oxygen_featured_post_checker_flusher' ); /** * Count the number of footer sidebars to enable dynamic classes for the footer * * @since Oxygen 0.2.2 */ function oxygen_footer_sidebar_class() { $count = 0; if ( is_active_sidebar( 'sidebar-3' ) ) $count++; if ( is_active_sidebar( 'sidebar-4' ) ) $count++; if ( is_active_sidebar( 'sidebar-5' ) ) $count++; if ( is_active_sidebar( 'sidebar-6' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; case '4': $class = 'four'; break; } if ( $class ) echo 'class="clear-fix ' . $class . '"'; } /** * Background wrapper style for front-end when a custom background image is set */ function oxygen_custom_background() { // Set the default color. $background_color = 'ffffff'; // If background color is specified use that color. if ( '' != get_background_color() ) : $background_color = get_background_color(); endif; ?> $is_rtl ); wp_localize_script( 'jquery-more-articles', 'masonry_setting', $settings ); } } add_action( 'wp_enqueue_scripts', 'oxygen_masonry_settings' ); /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php';