__( 'Primary Navigation', 'nirvana' ),
'top' => __( 'Top Navigation', 'nirvana' ),
'footer' => __( 'Footer Navigation', 'nirvana' ),
) );
// This theme allows users to set a custom background
add_theme_support( 'custom-background' );
// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be the same size as the header.
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
global $nirvana_hheight; global $nirvana_totalSize;
$nirvana_hheight = (int)$nirvana_hheight;
//set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
add_image_size('header', $nirvana_totalSize, $nirvana_hheight,true);
global $nirvana_fpsliderwidth; global $nirvana_fpsliderheight;
global $nirvana_colimageheight; global $nirvana_colimagewidth;
add_image_size('slider',$nirvana_fpsliderwidth,$nirvana_fpsliderheight,true);
add_image_size('columns',$nirvana_colimagewidth,$nirvana_colimageheight,true);
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See nirvana_admin_header_style(), below.
define( 'NO_HEADER_TEXT', true );
// Add support for flexible headers
$header_args = array(
'flex-height' => true,
'height' => $nirvana_hheight,
'flex-width' => true,
'width' => $nirvana_totalSize,
'max-width' => 1920,
'default-image' => '',
'admin-head-callback' => 'nirvana_admin_header_style',
);
add_theme_support( 'custom-header', $header_args );
// ... and thus ends the changeable header business.
// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers( array(
'nirvana' => array(
'url' => '%s/images/headers/nirvana.png',
'thumbnail_url' => '%s/images/headers/nirvana_thumbnail.png',
'description' => __( 'Nirvana Default Header Image', 'nirvana' )
),
) );
}
endif;
// Backwards compatibility for the title-tag
if ( ! function_exists( '_wp_render_title_tag' ) ) :
add_action( 'wp_head', 'nirvana_render_title' );
add_filter( 'wp_title', 'nirvana_filter_wp_title' );
add_filter('wp_title_rss','nirvana_filter_wp_title_rss');
endif;
function nirvana_render_title() { ?>
0)&&(strlen($title)>0))?$title.' - '.$site_name:$title.$site_name);
// Get the Site Description
$site_description = get_bloginfo( 'description' );
// If site front page, append description
if ( (is_home() || is_front_page()) && $site_description ) {
// Append Site Description to title
$filtered_title = ((strlen($site_name)>0)&&(strlen($site_description)>0))?$site_name. " | ".$site_description:$site_name.$site_description;
}
// Add pagination if that's the case
global $page, $paged;
if ( $paged >= 2 || $page >= 2 )
$filtered_title .= ' | ' . sprintf( __( 'Page %s', 'nirvana' ), max( $paged, $page ) );
// Return the modified title
return $filtered_title;
}
function nirvana_filter_wp_title_rss($title) {
return ' ';
}
if ( ! function_exists( 'nirvana_admin_header_style' ) ) :
/**
* Styles the header image displayed on the Appearance > Header admin panel.
*
* Referenced via add_custom_image_header() in nirvana_setup().
*
* @since nirvana 0.5
*/
function nirvana_admin_header_style() {
?>
'nav', 'container_class' => 'topmenu', 'theme_location' => 'top', 'depth' =>1 ) );
}
add_action ('cryout_topbar_hook','nirvana_top_menu',15);
// MAIN MENU
function nirvana_main_menu() {
/* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
'menu', 'menu_id' =>'prime_nav', 'theme_location' => 'primary', 'link_before' => '', 'link_after' => '' ) );
}
add_action ('cryout_access_hook','nirvana_main_menu');
// FOOTER MENU
function nirvana_footer_menu() {
if ( has_nav_menu( 'footer' ) )
wp_nav_menu( array( 'container' => 'nav', 'container_class' => 'footermenu', 'theme_location' => 'footer', 'depth' =>1 ) );
}
add_action ('cryout_footer_hook','nirvana_footer_menu' , 10);
/**
* Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
*
* To override nirvana_widgets_init() in a child theme, remove the action hook and add your own
* function tied to the init hook.
*
* @since nirvana 0.5
* @uses register_sidebar
*/
function nirvana_widgets_init() {
// Area 1, located at the top of the sidebar.
register_sidebar( array(
'name' => __( 'Left Sidebar', 'nirvana' ),
'id' => 'left-widget-area',
'description' => __( 'Left sidebar', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
register_sidebar( array(
'name' => __( 'Right Sidebar', 'nirvana' ),
'id' => 'right-widget-area',
'description' => __( 'Right sidebar', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 5, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Area', 'nirvana' ),
'id' => 'first-footer-widget-area',
'description' => __( 'First footer area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 6, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Second Footer Area', 'nirvana' ),
'id' => 'second-footer-widget-area',
'description' => __( 'Second footer area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 7, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Third Footer Area', 'nirvana' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third footer area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 8, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Fourth Footer Area', 'nirvana' ),
'id' => 'fourth-footer-widget-area',
'description' => __( 'The fourth footer area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 9, located above the content area. Empty by default.
register_sidebar( array(
'name' => __( 'Above Content Area', 'nirvana' ),
'id' => 'above-content-widget-area',
'description' => __( 'Above Content Area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 10, located below the content area. Empty by default.
register_sidebar( array(
'name' => __( 'Below Content Area', 'nirvana' ),
'id' => 'below-content-widget-area',
'description' => __( 'Below Content Area', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 0, located inside the header
register_sidebar( array(
'name' => __( 'Header Widgets', 'nirvana' ),
'id' => 'header-widget-area',
'description' => __( 'Header Widgets', 'nirvana' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
global $nirvana_colimagewidth;
global $nirvana_colimageheight;
// Area 11, the presentation page columns
register_sidebar( array(
'name' => __( 'Presentation Page Columns', 'nirvana' ),
'id' => 'presentation-page-columns-area',
'description' => sprintf(__('Only drag [Cryout Column] widgets here. Recommended size for uploaded images: %1$dpx (width) x %2$dpx (height). Go to the Nirvana Settings page >> Presentation Page Settings >> Columns to edit sizes and more.','nirvana' ),$nirvana_colimagewidth,$nirvana_colimageheight),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
/** Register sidebars by running nirvana_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'nirvana_widgets_init' );
/**
* Creates different class names for footer widgets depending on their number.
* This way they can fit the footer area.
*/
function nirvana_footer_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'first-footer-widget-area' ) )
$count++;
if ( is_active_sidebar( 'second-footer-widget-area' ) )
$count++;
if ( is_active_sidebar( 'third-footer-widget-area' ) )
$count++;
if ( is_active_sidebar( 'fourth-footer-widget-area' ) )
$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="footer' . $class . '"';
}
function nirvana_header_widget() {
if ( is_active_sidebar( 'header-widget-area' )) { ?>