modified nav behavior and css

This commit is contained in:
Mickey Kay
2013-10-08 10:27:38 -07:00
parent a17633c717
commit cd0e30ceef
4 changed files with 52 additions and 85 deletions
+10 -10
View File
@@ -13,7 +13,7 @@
*
*/
function mm_custom_defaults( $defaults ) {
function trestle_custom_defaults( $defaults ) {
$defaults['auto_nav'] = '0';
$defaults['include_home_link'] = '1';
@@ -21,14 +21,14 @@ function mm_custom_defaults( $defaults ) {
return $defaults;
}
add_filter( 'genesis_theme_settings_defaults', 'mm_custom_defaults' );
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
/**
* Sanitization
*/
function mm_register_social_sanitization_filters() {
function trestle_register_social_sanitization_filters() {
genesis_add_option_filter(
'no_html',
GENESIS_SETTINGS_FIELD,
@@ -46,7 +46,7 @@ function mm_register_social_sanitization_filters() {
)
);
}
add_action( 'genesis_settings_sanitizer_init', 'mm_register_social_sanitization_filters' );
add_action( 'genesis_settings_sanitizer_init', 'trestle_register_social_sanitization_filters' );
/**
@@ -55,17 +55,17 @@ add_action( 'genesis_settings_sanitizer_init', 'mm_register_social_sanitization_
* @param string $_genesis_theme_settings_pagehook
*/
function mm_register_settings_box( $_genesis_theme_settings_pagehook ) {
add_meta_box('mm-navigation-settings', 'Primary Navigation', 'mm_navigation_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
add_meta_box('mm-footer-settings', 'Footer', 'mm_footer_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
function trestle_register_settings_box( $_genesis_theme_settings_pagehook ) {
add_meta_box('mm-navigation-settings', 'Primary Navigation', 'trestle_navigation_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
// add_meta_box('mm-footer-settings', 'Footer', 'trestle_footer_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
}
add_action('genesis_theme_settings_metaboxes', 'mm_register_settings_box');
add_action('genesis_theme_settings_metaboxes', 'trestle_register_settings_box');
/**
* Create Navigation Metabox
*/
function mm_navigation_settings_box() {
function trestle_navigation_settings_box() {
?>
<p>
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]" value="1" <?php checked( esc_attr( genesis_get_option('auto_nav') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]">Automatically generate nav menu (replaces custom/manual menu with auto-generated menu)</label><br />
@@ -78,7 +78,7 @@ function mm_navigation_settings_box() {
* Create Footer Metabox
*/
function mm_footer_settings_box() {
function trestle_footer_settings_box() {
?>
<p>
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[footer_text]">Custom footer text</label><br />
-57
View File
@@ -1,57 +0,0 @@
// as the page loads, cal these scripts
jQuery(document).ready(function() {
var h = window.location.host.toLowerCase();
jQuery("a[href^='http']:not([href*='" + h + "']), a[href$='.pdf'], a[hrefjQuery$='.mp3'], a[href$='.m4a'], a[href$='.wav']").attr("target", "_blank");
// Specifically for press kit link
jQuery("a[href*='press-kit']").attr("target", "_blank");
jQuery("a[href^='http://']:not([href*='" + h + "'])").addClass("externalLink");
jQuery("a[href^='https://']:not([href*='" + h + "'])").addClass("externalLink");
jQuery("img").parent().removeClass("externalLink");
// Niceify the HRs
jQuery('hr').wrap('<div class="hr"></div>');
// Add classes to different types of media links
jQuery('a[href^="http://www.youtube"]').removeClass('externalLink');
jQuery('a[href^="mailto:"]').addClass('emailLink');
jQuery('a[href*=".pdf"]').attr({"target":"_blank"});
jQuery('a[href*=".pdf"]').addClass('pdfLink');
jQuery("img").parent().removeClass("pdfLink");
// Add classes to parts of lists
jQuery('li:last-child').addClass('last');
jQuery('li:first-child').addClass('first');
jQuery('.children').parent('li').addClass('parent');
// Mobile navigation button
jQuery('#menu-button').click(function() {
var button = jQuery(this);
button.toggleClass('open');
jQuery('.menu-primary').slideToggle();
});
// Mobile navigation icons
var closedIcon = '+';
var openIcon = '-';
jQuery('.genesis-nav-menu .parent:not(.current-menu-item, .current_page_item, .current_page_parent, .current_page_ancestor) > a').after('<a class="sub-icon" href="javscript: void()">' + closedIcon + '</a>');
jQuery('.genesis-nav-menu .parent.current-menu-item > a, .genesis-nav-menu .parent.current_page_item > a, .genesis-nav-menu .parent.current_page_parent > a, .genesis-nav-menu .parent.current_page_ancestor > a').after('<a class="sub-icon" href="javscript: void()">' + openIcon + '</a>');
jQuery('.sub-icon').click(function() {
var icon = jQuery(this);
icon.next('ul').slideToggle();
if ( icon.text().indexOf( closedIcon ) !== -1 )
icon.text(openIcon);
else if ( icon.text().indexOf( openIcon ) !== -1 )
icon.text(closedIcon);
});
}); /* end of as page load scripts */
// executes when complete page is fully loaded, including all frames, objects and images
jQuery(window).load(function() {
});