Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Header widget area
  • Loading branch information
Brian C Dunnigan committed Dec 23, 2016
1 parent 473de21 commit e204877
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 151 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -14,3 +14,5 @@ prepros.cfg
sass/_notes/dwsync.xml

css/_notes/dwsync.xml

js/_notes/dwsync.xml
190 changes: 96 additions & 94 deletions header.php
@@ -1,95 +1,97 @@
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
*/
if ( apply_filters( 'load_custom_header', false ) ) {
$custom_header = apply_filters( 'get_custom_header', '' );

if ( '' != $custom_header ) {
// Get the header that we just received
// and call the native 'get_header' function
// as usual
load_template( $custom_header );

// By calling 'return' we are skipping
// parsing this template any further
return;
}
}
include 'inc/vars.php';
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
<!--[if !IE]><!--><script>
if (/*@cc_on!@*/false) {
document.documentElement.className+=' ie10';
}
</script><!--<![endif]-->
</head>
<body <?php body_class(); ?>>
<!--[if lt IE 7]> <div class="ie lte9 lte8 lte7 lte6"> <![endif]-->
<!--[if IE 7]> <div class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]> <div class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]> <div class="ie ie9 lte9"> <![endif]-->
<nav id="skiplinks">
<a href="#site-navigation">Skip to Navigation</a>
<a href="#uc-search">Skip to UConn Search</a>
<a href="#content">Skip to Content</a>
</nav>
<?php if(function_exists('uconn_banner_hook')){uconn_banner_hook();}?>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header <?php if ($headerImg != ''){echo 'header-image';} ?>" role="banner">
<div id="site-title" class="hidden-xs">
<div class="container">
<?php include 'inc/header-img.php'; ?>
<div class="row">
<div class="col-sm-8">
<div class="site-branding" id="uc-site-header">
<?php include 'inc/site-title.php'; ?>
</div>
</div>
<div class="col-sm-4">
<?php get_search_form(); ?>
</div>
</div>
</div>
</div>
<div id="nav-wrapper">

<?php
// Check to see if max mega menu is active
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php');

if (!$maxMegaMenuActive){
if ($navStyle == 'drop-multi'){
include 'inc/nav-drop-multi.php';
} else if ($navStyle == 'tabs'){
include 'inc/nav-tabs.php';
} else {
// std. Bootstrap dropdowns.
include 'inc/nav.php';
}
} else {
include 'inc/nav-maxmegamenu.php';
}


?>
</div>
</header>
<!-- #masthead -->
<div id="content" class="site-content">
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
*/
if ( apply_filters( 'load_custom_header', false ) ) {
$custom_header = apply_filters( 'get_custom_header', '' );

if ( '' != $custom_header ) {
// Get the header that we just received
// and call the native 'get_header' function
// as usual
load_template( $custom_header );

// By calling 'return' we are skipping
// parsing this template any further
return;
}
}
include 'inc/vars.php';
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
<!--[if !IE]><!--><script>
if (/*@cc_on!@*/false) {
document.documentElement.className+=' ie10';
}
</script><!--<![endif]-->
</head>
<body <?php body_class(); ?>>
<!--[if lt IE 7]> <div class="ie lte9 lte8 lte7 lte6"> <![endif]-->
<!--[if IE 7]> <div class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]> <div class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]> <div class="ie ie9 lte9"> <![endif]-->
<nav id="skiplinks">
<a href="#site-navigation">Skip to Navigation</a>
<a href="#uc-search">Skip to UConn Search</a>
<a href="#content">Skip to Content</a>
</nav>
<?php if(function_exists('uconn_banner_hook')){uconn_banner_hook();}?>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header <?php if ($headerImg != ''){echo 'header-image';} ?>" role="banner">
<div id="site-title" class="hidden-xs">
<div class="container">
<?php include 'inc/header-img.php'; ?>
<div class="row">
<div class="col-sm-8">
<div class="site-branding" id="uc-site-header">
<?php include 'inc/site-title.php'; ?>
</div>
</div>

<div class="col-sm-4 header-widget-area">
<?php get_search_form(); ?>
<?php ( is_active_sidebar('header-widget-area') ? dynamic_sidebar('header-widget-area'): '' ); ?> <!-- this is hidden when no widget is present -->
</div>
</div>
</div>
</div>
<div id="nav-wrapper">

<?php
// Check to see if max mega menu is active
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php');

if (!$maxMegaMenuActive){
if ($navStyle == 'drop-multi'){
include 'inc/nav-drop-multi.php';
} else if ($navStyle == 'tabs'){
include 'inc/nav-tabs.php';
} else {
// std. Bootstrap dropdowns.
include 'inc/nav.php';
}
} else {
include 'inc/nav-maxmegamenu.php';
}


?>
</div>
</header>
<!-- #masthead -->
<div id="content" class="site-content">
<div class="container">
11 changes: 6 additions & 5 deletions inc/reg-sidebars.php
Expand Up @@ -43,19 +43,20 @@ if ( function_exists('register_sidebar') ) {
$sidebars['sidebar']['id'] = 'sidebar';
register_sidebar($sidebars['sidebar']);
}


/*register_sidebar(array(
'name' => __( 'Sidebar', 'theme_text_domain' ),
'id' => 'sidebar',
'description' => 'Appears with Archives, Search Results, the Blog page template, and when viewing single posts.',
register_sidebar(array(
'name' => __( 'Header Content', 'theme_text_domain' ),
'id' => 'header-widget-area',
'description' => 'Widget area for header. Limited to 2 widgets.',
'class' => 'sidebar',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<div class="widget-head"><h2 class="widget-title">',
'after_title' => '</h2></div>'
));

register_sidebar( array(
/*register_sidebar( array(
'name' => __( 'Mega Footer' ),
'id' => 'mega-footer',
'description' => 'Limited to 6 widgets. Will appear at the bottom of every page in the site.',
Expand Down
103 changes: 52 additions & 51 deletions inc/scripts-and-styles.php
@@ -1,52 +1,53 @@
<?php
function cs_scripts() {

wp_enqueue_style( 'cs-glyph', site_url().'/wp-content/global/glyphicons_pro/glyphicons/web/html_css/css/glyphicons.css');
wp_enqueue_style( 'cs-glyph-filetypes', site_url().'/wp-content/global/glyphicons_pro/glyphicons-filetypes/web/html_css/css/glyphicons-filetypes.css');
wp_enqueue_style( 'cs-glyph-halflings', site_url().'/wp-content/global/glyphicons_pro/glyphicons-halflings/web/html_css/css/glyphicons-halflings.css');
wp_enqueue_style( 'cs-glyph-social', site_url().'/wp-content/global/glyphicons_pro/glyphicons-social/web/html_css/css/glyphicons-social.css');
wp_enqueue_style( 'cs-style', get_stylesheet_uri(), array( 'cs-glyph' ));
wp_enqueue_style( 'cs-print', get_template_directory_uri() .'/css/print.css', array( 'cs-style' ), false, 'print');

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php');
if ($maxMegaMenuActive){
wp_enqueue_style( 'cs-megamenu', get_template_directory_uri(). '/css/megamenu-cornerstone-base.css', array( 'cs-style' ));
};

wp_enqueue_script( 'cs-bootstrap-js', site_url().'/wp-content/global/bootstrap-3.3.4/javascripts/bootstrap.min.js', array( 'jquery' ));
wp_enqueue_script( 'cs-modernizr', get_template_directory_uri() . '/js/cs-modernizr.js', array( 'jquery' ));
wp_enqueue_script( 'cs', get_template_directory_uri() . '/js/cs.js', array( 'jquery' ));
wp_enqueue_script( 'cs-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'cs-bootstrap-js'), '20120206', true );
wp_enqueue_script( 'cs-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );

$outboundtracking = get_option( 'outbound_tracking','');
if($outboundtracking == 'yes') wp_enqueue_script('uc-link-tracking', get_bloginfo('template_url').'/js/linktracking.js', array('jquery'));

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}

if(get_option('stickynav') == 'on') {
wp_enqueue_script( 'stickynav', get_template_directory_uri() . '/js/stickynav.js', array( 'jquery' ));
}
}

add_action( 'wp_enqueue_scripts', 'cs_scripts' );


function load_cornerstone_wp_admin_style($hook) {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css' );
wp_enqueue_style( 'custom_wp_admin_css' );


wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js' );
wp_enqueue_script('uc-admin-js');

if( 'widgets.php' != $hook )
return;
wp_register_style( 'css-widgets-area', get_template_directory_uri().'/css/widgets-area.php' );
wp_enqueue_style( 'css-widgets-area' );
}
add_action( 'admin_enqueue_scripts', 'load_cornerstone_wp_admin_style' );
<?php
function cs_scripts() {

wp_enqueue_style( 'cs-glyph', site_url().'/wp-content/global/glyphicons_pro/glyphicons/web/html_css/css/glyphicons.css');
wp_enqueue_style( 'cs-glyph-filetypes', site_url().'/wp-content/global/glyphicons_pro/glyphicons-filetypes/web/html_css/css/glyphicons-filetypes.css');
wp_enqueue_style( 'cs-glyph-halflings', site_url().'/wp-content/global/glyphicons_pro/glyphicons-halflings/web/html_css/css/glyphicons-halflings.css');
wp_enqueue_style( 'cs-glyph-social', site_url().'/wp-content/global/glyphicons_pro/glyphicons-social/web/html_css/css/glyphicons-social.css');
wp_enqueue_style( 'cs-style', get_stylesheet_uri(), array( 'cs-glyph' ));
wp_enqueue_style( 'cs-print', get_template_directory_uri() .'/css/print.css', array( 'cs-style' ), false, 'print');

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php');
if ($maxMegaMenuActive){
wp_enqueue_style( 'cs-megamenu', get_template_directory_uri(). '/css/megamenu-cornerstone-base.css', array( 'cs-style' ));
};

wp_enqueue_script( 'cs-bootstrap-js', site_url().'/wp-content/global/bootstrap-3.3.4/javascripts/bootstrap.min.js', array( 'jquery' ));
wp_enqueue_script( 'cs-modernizr', get_template_directory_uri() . '/js/cs-modernizr.js', array( 'jquery' ));
wp_enqueue_script( 'cs', get_template_directory_uri() . '/js/cs.js', array( 'jquery' ));
wp_enqueue_script( 'cs-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'cs-bootstrap-js'), '20120206', true );
wp_enqueue_script( 'cs-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_script( 'cs-header-widgets', get_template_directory_uri() . '/js/header-widgets.js', array( 'jquery' ));

$outboundtracking = get_option( 'outbound_tracking','');
if($outboundtracking == 'yes') wp_enqueue_script('uc-link-tracking', get_bloginfo('template_url').'/js/linktracking.js', array('jquery'));

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}

if(get_option('stickynav') == 'on') {
wp_enqueue_script( 'stickynav', get_template_directory_uri() . '/js/stickynav.js', array( 'jquery' ));
}
}

add_action( 'wp_enqueue_scripts', 'cs_scripts' );


function load_cornerstone_wp_admin_style($hook) {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css' );
wp_enqueue_style( 'custom_wp_admin_css' );


wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js' );
wp_enqueue_script('uc-admin-js');

if( 'widgets.php' != $hook )
return;
wp_register_style( 'css-widgets-area', get_template_directory_uri().'/css/widgets-area.php' );
wp_enqueue_style( 'css-widgets-area' );
}
add_action( 'admin_enqueue_scripts', 'load_cornerstone_wp_admin_style' );
?>
1 change: 0 additions & 1 deletion js/_notes/dwsync.xml

This file was deleted.

20 changes: 20 additions & 0 deletions js/header-widgets.js
@@ -0,0 +1,20 @@
jQuery(document).ready(function( $ ) {
if ($("#masthead .col-sm-4 .widget")[0]){ //if a widget exists in the header area
$("#masthead .col-sm-4 .searchform").hide(); // hide default search
$("#masthead .col-sm-4").removeClass( "col-sm-4" ).addClass( "col-sm-6" ); // make old search wrapper larger
$("#masthead .col-sm-8").removeClass( "col-sm-8" ).addClass( "col-sm-6" ); //change site title area since search area is now larger
$("#masthead .col-sm-6 .widget .searchform").show(); // allow search widget to be showed when added to search area

var $widget = $('#masthead .col-sm-6 .widget');
$widget.css('width',(100/$widget.length).toString()+'%');
//$widget.css('width', '50%');

var $widgetMenuHeight = $('#masthead .col-sm-6 .widget .menu'); //Center menu widget
$widgetMenuHeight.css('margin-top', ($('#uc-site-header').outerHeight() - $('#masthead .col-sm-6 .widget .menu li a').outerHeight())/2);

} else { //if no widget exists
$("#masthead .col-sm-4.widget").removeClass("col-sm-4").hide();
}


});

0 comments on commit e204877

Please sign in to comment.