'scroll', 'footer_widgets' => false, 'container' => 'content', 'wrapper' => true, 'footer' => 'main', ) ); /** * Enable support for Post Thumbnails */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( '100', '100', true ); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Header Top', 'my-life' ), 'secondary' => __( 'Header Bottom', 'my-life' ), 'subsidiary' => __( 'Footer', 'my-life' ), ) ); /** * Add support for custom backgrounds */ $my_life_defaults = array( 'default-color' => 'f7f6f2', 'default-image' => get_template_directory_uri() . '/images/bg.png', ); add_theme_support( 'custom-background', $my_life_defaults ); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'audio', 'gallery', 'status' ) ); } endif; // my_life_setup add_action( 'after_setup_theme', 'my_life_setup' ); /** * Register widgetized area and update sidebar with default widgets * * @since My Life 1.0 */ function my_life_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Sidebar', 'my-life' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'my_life_widgets_init' ); /** * If we've set a value of "both" in the Customizer, but removed one sidebar, * we need to reset the sidebar placement to "right" */ function my_life_reset_sidebar_placement() { if ( ! is_active_sidebar( 'sidebar-1' ) || ! is_active_sidebar( 'sidebar-2' ) && 'both' == get_theme_mod( 'sidebar_placement', 'right' ) ) set_theme_mod( 'sidebar_placement', 'right' ); } add_action( 'template_redirect', 'my_life_reset_sidebar_placement' ); /** * Enqueue scripts and styles */ function my_life_scripts() { wp_enqueue_style( 'my-life-style', get_stylesheet_uri() ); wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120123', true ); wp_enqueue_script( 'submenu', get_template_directory_uri() . '/js/submenu.js', array( 'jquery' ), '20120123', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'my_life_scripts' ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); if ( ! function_exists( 'my_life_breadcrumbs' ) ) : /** * Displays a breadcrumb navigation */ function my_life_breadcrumbs() { $cat_parents = null; if ( !is_home() && !is_front_page() ) { $sep = ' » '; $before = ''; $after = ''; echo '' . __( 'Home', 'my-life' ) . '' . $sep; if ( is_category() ) { global $wp_query; $cat = get_category( $wp_query->get_queried_object()->term_id ); if ( 0 !== $cat->parent ) { $cat_parents = get_category_parents( get_category( $cat->parent ), true, $sep ); } if ( 0 < $cat->parent && ! is_wp_error( $cat_parents ) ) echo $cat_parents; echo $before . single_cat_title() . $after; } elseif ( is_day() ) { echo '' . get_the_time( 'Y' ) . '' . $sep; echo '' . get_the_time( 'F' ) . '' . $sep; echo $before . get_the_time( 'd' ) . $after; } elseif ( is_month() ) { echo '' . get_the_time( 'Y' ) . '' . $sep; echo $before . get_the_time( 'F' ) . $after; } elseif ( is_year() ) { echo $before . get_the_time( 'Y' ) . $after; } elseif ( is_single() ) { if ( is_attachment() ) { global $post; echo '' . get_the_title( $post->post_parent ) . '' . $sep . $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; $cat_parents = get_category_parents( $cat, true, $sep ); if ( ! is_wp_error( $cat_parents ) ) echo $cat_parents . $before . get_the_title() . $after; } } elseif ( is_page() ) { global $post; if ( $post->post_parent ) { $parent_id = $post->post_parent; $parent_links = array(); while ( $parent_id ) { $page = get_page( $parent_id ); $parent_links[] = '' . get_the_title( $page->ID ) . ''; $parent_id = $page->post_parent; } echo implode( $sep, array_reverse( $parent_links ) ) . $sep; } echo $before . get_the_title() . $after; } elseif ( is_search() ) { echo $before . sprintf( __( 'Search results for '%s'', 'my-life' ), get_search_query() ) . $after; } elseif ( is_tag() ) { echo $before . sprintf( __( 'Posts tagged '%s'', 'my-life' ), single_tag_title( '', false ) ) . $after; } elseif ( is_author() ) { global $author; echo $before . sprintf( __( 'Articles posted by %s', 'my-life' ), get_userdata( $author )->display_name ) . $after; } elseif ( is_404() ) { echo $before . __( 'Error 404', 'my-life' ) . $after; } if ( get_query_var( 'paged' ) ) { echo ' (' . sprintf( __( 'Page %s', 'my-life' ), get_query_var( 'paged' ) ) . ')'; } } } endif;