__( 'Primary Menu', 'base' ), ) ); // Enable support for Post Formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // Allows theme developers to link a custom stylesheet file to the TinyMCE visual editor. function base_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'init', 'base_add_editor_styles' ); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'base_custom_background_args', array( 'default-color' => 'f9f9f9', 'default-image' => '', ) ) ); // Enable support for HTML5 markup. add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) ); } endif; // base_setup add_action( 'after_setup_theme', 'base_setup' ); /** * Register widgetized area and update sidebar with default widgets. */ function base_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'base' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Area footer 1, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'base' ), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'base' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Area footer 2, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'base' ), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'base' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Area footer 3, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'base' ), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'base' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Area footer 4, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', 'base' ), 'id' => 'fourth-footer-widget-area', 'description' => __( 'The fourth footer widget area', 'base' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'base_widgets_init' ); /** * Enqueue scripts and styles. */ function base_scripts() { wp_enqueue_style( 'base-style', get_stylesheet_uri() ); wp_enqueue_style( 'base-skeleton', get_template_directory_uri().'/css/skeleton.css' ); wp_enqueue_style( 'base-layout', get_template_directory_uri().'/css/layout.css' ); wp_enqueue_style( 'base-icon', get_template_directory_uri().'/inc/icon/style.css' ); wp_enqueue_script( 'base-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'base-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); wp_enqueue_script( 'base-sticky-nav', get_template_directory_uri() . '/js/sticky-nav.js', array( 'jquery' ), '', true ); wp_enqueue_script( 'base-retina_js', get_template_directory_uri() . '/js/retina.js', '', '', true ); wp_enqueue_style( 'base-google-webfonts', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'base_scripts' ); function base_wp_head(){ ?> '; if (!is_home()) { echo ''; echo 'Home'; echo " » "; if (is_category() || is_single()) { the_category(' » '); if (is_single()) { echo " » "; the_title(); } } elseif (is_page()) { echo the_title(); } } echo ''; } /* * Add favicon. */ function base_favicon() { ?> $value ) { if ( is_array( $value ) ) { foreach ( $value as $image => $attr ) { if ( is_array( $attr ) ) retina_support_create_images( get_attached_file( $attachment_id ), $attr['width'], $attr['height'], true ); } } } return $metadata; } add_filter( 'wp_generate_attachment_metadata', 'retina_support_attachment_meta', 10, 2 ); /** * Create retina-ready images */ function retina_support_create_images( $file, $width, $height, $crop = false ) { if ( $width || $height ) { $resized_file = wp_get_image_editor( $file ); if ( ! is_wp_error( $resized_file ) ) { $filename = $resized_file->generate_filename( $width . 'x' . $height . '@2x' ); $resized_file->resize( $width * 2, $height * 2, $crop ); $resized_file->save( $filename ); $info = $resized_file->get_size(); return array( 'file' => wp_basename( $filename ), 'width' => $info['width'], 'height' => $info['height'], ); } } return false; } add_filter( 'delete_attachment', 'delete_retina_support_images' ); /** * Delete retina-ready images */ function delete_retina_support_images( $attachment_id ) { $meta = wp_get_attachment_metadata( $attachment_id ); $upload_dir = wp_upload_dir(); $path = pathinfo( $meta['file'] ); foreach ( $meta as $key => $value ) { if ( 'sizes' === $key ) { foreach ( $value as $sizes => $size ) { $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . $size['file']; $retina_filename = substr_replace( $original_filename, '@2x.', strrpos( $original_filename, '.' ), strlen( '.' ) ); if ( file_exists( $retina_filename ) ) unlink( $retina_filename ); } } } } /* * Schema.org. */ function base_tag_schema() { $schema = 'http://schema.org/'; // Is single post if(is_single()) { $type = "Article"; } // Is author page elseif( is_author() ) { $type = 'ProfilePage'; } // Is search results page elseif( is_search() ) { $type = 'SearchResultsPage'; } else { $type = 'WebPage'; } echo 'itemscope="itemscope" itemtype="' . $schema . $type . '"'; } /* * Woocommerce support. */ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); add_action('woocommerce_before_main_content', 'base_wrapper_start', 10); add_action('woocommerce_after_main_content', 'base_wrapper_end', 10); function base_wrapper_start() { echo '
'; } function base_wrapper_end() { echo '
'; } add_theme_support( 'woocommerce' );