__( 'Primary Navigation', 'mantra' ),
'top' => __( 'Top Navigation', 'mantra' ),
'footer' => __( 'Footer Navigation', 'mantra' ),
) );
// 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 $mantra_hheight;
$mantra_hheight=(int)$mantra_hheight;
global $mantra_totalSize;
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'mantra_header_image_width', $mantra_totalSize ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'mantra_header_image_height', $mantra_hheight) );
//set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
add_image_size('header',HEADER_IMAGE_WIDTH,HEADER_IMAGE_HEIGHT,true);
global $mantra_fpsliderwidth;
global $mantra_fpsliderheight;
add_image_size('slider',$mantra_fpsliderwidth,$mantra_fpsliderheight,true);
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See mantra_admin_header_style(), below.
define( 'NO_HEADER_TEXT', true );
add_theme_support( 'custom-header' );
// ... and thus ends the changeable header business.
// Backwards compatibility with pre 3.4 versions for custom background and header
// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers( array(
'mantra' => array(
'url' => '%s/images/headers/mantra.png',
'thumbnail_url' => '%s/images/headers/mantra-thumbnail.png',
// translators: header image description
'description' => __( 'mantra', 'mantra' )
),
) );
}
endif;
// remove obsolete mantra functions action hooks
if ( ! function_exists( 'mantra_remove_obsolete_functions' ) ) :
function mantra_remove_obsolete_functions() {
remove_filter( 'wp_title', 'mantra_filter_wp_title' );
remove_filter('wp_title_rss','mantra_filter_wp_title_rss');
}
add_action('init','mantra_remove_obsolete_functions');
endif;
// Backwards compatibility for the title-tag
if ( ! function_exists( '_wp_render_title_tag' ) ) :
add_action( 'wp_head', 'mantra_render_title' );
add_filter( 'wp_title', 'mantra_filter_wp_title2' );
add_filter('wp_title_rss','mantra_filter_wp_title_rss2');
endif;
function mantra_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', 'mantra' ), max( $paged, $page ) );
// Return the modified title
return $filtered_title;
}
function nirvana_filter_wp_title_rss2($title) {
return ' ';
}
if ( ! function_exists( 'mantra_admin_header_style' ) ) :
/**
* Styles the header image displayed on the Appearance > Header admin panel.
*
* Referenced via add_custom_image_header() in mantra_setup().
*
* @since mantra 0.5
*/
function mantra_admin_header_style() {
?>
'nav', 'container_class' => 'topmenu', 'theme_location' => 'top', 'depth' => 1 ) );
}
add_action ('cryout_wrapper_hook','mantra_top_menu');
// MAIN MENU
function mantra_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' ) );
}
add_action ('cryout_access_hook','mantra_main_menu');
// FOOTER MENU
function mantra_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','mantra_footer_menu',10);
/**
* Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
*
* To override mantra_widgets_init() in a child theme, remove the action hook and add your own
* function tied to the init hook.
*
* @since mantra 0.5
* @uses register_sidebar
*/
function mantra_widgets_init() {
// Area 1, located at the top of the sidebar.
register_sidebar( array(
'name' => __( 'Primary Widget Area - Sidebar 1', 'mantra' ),
'id' => 'primary-widget-area',
'description' => __( 'Primary widget area - Sidebar 1', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
register_sidebar( array(
'name' => __( 'Secondary Widget Area - Sidebar 1', 'mantra' ),
'id' => 'secondary-widget-area',
'description' => __( 'Secondary widget area - Sidebar 1', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 3 for the second sidebar. Empty be default
register_sidebar( array(
'name' => __( 'Third Widget Area - Sidebar 2', 'mantra' ),
'id' => 'third-widget-area',
'description' => __( 'Third widget area - Sidebar 2', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 4, located below the Third Widget Area in the second sidebar. Empty by default.
register_sidebar( array(
'name' => __( 'Fourth Widget Area - Sidebar 2', 'mantra' ),
'id' => 'fourth-widget-area',
'description' => __( 'Fourth widget area - Sidebar 2', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 5, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'mantra' ),
'id' => 'first-footer-widget-area',
'description' => __( 'First footer widget area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 6, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'mantra' ),
'id' => 'second-footer-widget-area',
'description' => __( 'Second footer widget area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 7, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'mantra' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third footer widget area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 8, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Fourth Footer Widget Area', 'mantra' ),
'id' => 'fourth-footer-widget-area',
'description' => __( 'The fourth footer widget area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 9, located above the content area. Empty by default.
register_sidebar( array(
'name' => __( 'Above content Widget Area', 'mantra' ),
'id' => 'above-content-widget-area',
'description' => __( 'Above content Widget Area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 10, located below the content area. Empty by default.
register_sidebar( array(
'name' => __( 'Below Content Widget Area', 'mantra' ),
'id' => 'below-content-widget-area',
'description' => __( 'Below Content Widget Area', 'mantra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
/** Register sidebars by running mantra_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'mantra_widgets_init' );
/**
* Creates different class names for footer widgets depending on their number.
* This way they can fit the footer area.
*/
function mantra_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 mantra_above_widget() {
if ( is_active_sidebar( 'above-content-widget-area' )) { ?>