__( 'Primary Navigation', 'elegant-grunge' ), ) ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'print-style' ); } add_action( 'after_setup_theme', 'elegant_grunge_setup' ); /** * Enqueue scripts and styles */ function elegant_grunge_scripts() { global $wp_styles; wp_enqueue_style( 'elegant-grunge', get_stylesheet_uri() ); wp_enqueue_style( 'elegant-grunge-ie', get_template_directory_uri() . '/ie.css', array( 'elegant-grunge' ) ); $wp_styles->add_data( 'elegant-grunge-ie', 'conditional', 'lt IE 8' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'elegant_grunge_scripts' ); /** * Set up widget areas */ function elegant_grunge_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Widget Area', 'elegant-grunge' ), 'id' => 'sidebar-1', 'description' => __( 'The primary widget area', 'elegant-grunge' ), 'before_widget ' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Secondary Widget Area', 'elegant-grunge' ), 'id' => 'sidebar-2', 'description' => __( 'The secondary widget area appears with 3-column layouts (two sidebars)', 'elegant-grunge' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area', 'elegant-grunge' ), 'id' => 'footer-1', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } add_action( 'widgets_init', 'elegant_grunge_widgets_init' ); /** * Adding home link to page navigation */ function elegant_grunge_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'elegant_grunge_page_menu_args' ); /** * Get current theme options with defaults as fallback */ function elegant_grunge_get_theme_options() { $defaults = array( 'theme_layout' => 'content-sidebar', ); $options = get_option( 'elegant_grunge_theme_options', $defaults ); return $options; } /** * Returns the current layout as selected in the theme options */ function elegant_grunge_current_layout() { $options = elegant_grunge_get_theme_options(); $current_layout = $options['theme_layout']; if ( is_attachment() || is_page_template( 'no-sidebar-page.php') ) return 'no-sidebar'; $two_columns = array( 'content-sidebar', 'sidebar-content' ); if ( in_array( $current_layout, $two_columns ) ) return 'two-column ' . $current_layout; elseif ( 'content-sidebar-sidebar' == $current_layout ) return 'three-column ' . $current_layout; return $current_layout; } /** * Adds elegant_grunge_current_layout() to the array of body classes */ function elegant_grunge_body_class($classes) { $classes[] = elegant_grunge_current_layout(); return $classes; } add_filter( 'body_class', 'elegant_grunge_body_class' ); /** * Load theme options */ require_once( get_template_directory() . '/inc/theme-options.php' ); /** * Comments template callback */ function elegant_grunge_comments_template( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; ?>
  • id="comment-">
    comment_approved ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    tag based on what is being viewed. * * @since Elegant Grunge 1.0.4 */ function elegant_grunge_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'elegant-grunge' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'elegant_grunge_wp_title', 10, 2 ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Load Jetpack compatibility file. */ if ( file_exists( get_template_directory() . '/inc/jetpack.php' ) ) require get_template_directory() . '/inc/jetpack.php';