mirror of
https://github.com/10h30/trestle.git
synced 2026-07-11 18:56:07 +09:00
modified nav behavior and css
This commit is contained in:
+15
-11
@@ -38,7 +38,7 @@ function header_actions() {
|
||||
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,700' );
|
||||
|
||||
// Custom jQuery
|
||||
wp_enqueue_script( 'mm_jquery', get_stylesheet_directory_uri() . '/includes/mm-jquery.js', array( 'jquery' ), '1.0', true );
|
||||
wp_enqueue_script( 'trestle_jquery', get_stylesheet_directory_uri() . '/includes/trestle-jquery.js', array( 'jquery' ), '1.0', true );
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'header_actions');
|
||||
@@ -203,13 +203,16 @@ add_action( 'tgmpa_register', 'register_required_plugins' );
|
||||
* Auto & Mobile Navigation
|
||||
===========================================*/
|
||||
|
||||
function mm_nav_modifications() {
|
||||
function trestle_nav_modifications() {
|
||||
|
||||
// Auto-generate nav if Genesis theme setting is checked
|
||||
if ( 1 == genesis_get_option( 'auto_nav' ) ) {
|
||||
|
||||
// Remove existing nav
|
||||
remove_action( 'genesis_after_header', 'genesis_do_nav' );
|
||||
|
||||
// Replace existing nav with auto-generated nav
|
||||
function mm_auto_nav() {
|
||||
function trestle_auto_nav() {
|
||||
|
||||
$args = array(
|
||||
'echo' => false,
|
||||
@@ -232,30 +235,31 @@ function mm_nav_modifications() {
|
||||
$nav_markup_close = genesis_structural_wrap( 'menu-primary', 'close', 0 );
|
||||
$nav_markup_close .= genesis_html5() ? '</nav>' : '</div>';
|
||||
|
||||
echo apply_filters ( 'mm_do_nav', $nav_markup_open . $nav . $nav_markup_close );
|
||||
echo apply_filters ( 'trestle_do_nav', $nav_markup_open . $nav . $nav_markup_close );
|
||||
}
|
||||
add_action( 'genesis_do_nav', 'mm_auto_nav', 10 );
|
||||
add_action( 'genesis_after_header', 'trestle_auto_nav', 10 );
|
||||
|
||||
}
|
||||
|
||||
// Add mobile menu button
|
||||
function mm_add_mobile_nav() {
|
||||
echo '<a id="menu-button" class="button" href="javascript: void()"><i class="icon-list-ul"></i> Navigation</a>';
|
||||
function trestle_add_mobile_nav() {
|
||||
if ( 1 == genesis_get_option( 'auto_nav' ) || has_nav_menu( 'primary' ) )
|
||||
echo '<a id="menu-button" class="button" href="javascript: void()"><i class="icon-list-ul"></i> Navigation</a>';
|
||||
}
|
||||
add_action( 'genesis_after_header', 'mm_add_mobile_nav', 0 );
|
||||
add_action( 'genesis_after_header', 'trestle_add_mobile_nav', 0 );
|
||||
|
||||
|
||||
}
|
||||
add_action( 'init', 'mm_nav_modifications' );
|
||||
add_action( 'init', 'trestle_nav_modifications' );
|
||||
|
||||
|
||||
/*===========================================
|
||||
* Footer
|
||||
===========================================*/
|
||||
function mm_custom_footer($output) {
|
||||
function trestle_custom_footer($output) {
|
||||
return $output . '<p>[footer_childtheme_link before=""] by <a href="http://mightyminnow.com">MIGHTYminnow</a></p>';
|
||||
}
|
||||
add_filter( 'genesis_footer_output', 'mm_custom_footer' );
|
||||
add_filter( 'genesis_footer_output', 'trestle_custom_footer' );
|
||||
/*===========================================
|
||||
* Shortcodes
|
||||
===========================================*/
|
||||
+10
-10
@@ -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 />
|
||||
|
||||
@@ -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() {
|
||||
|
||||
});
|
||||
@@ -137,6 +137,8 @@ body {
|
||||
a,
|
||||
button,
|
||||
input:focus,
|
||||
input[type="text"],
|
||||
input[type="search"],
|
||||
input[type="button"],
|
||||
input[type="reset"],
|
||||
input[type="submit"],
|
||||
@@ -147,6 +149,8 @@ textarea:focus,
|
||||
-ms-transition: all 0.1s ease-in-out;
|
||||
-o-transition: all 0.1s ease-in-out;
|
||||
transition: all 0.1s ease-in-out;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
@@ -860,12 +864,6 @@ Site Navigation
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nav-primary {
|
||||
margin: 0 20px;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.genesis-nav-menu {
|
||||
clear: both;
|
||||
color: #999;
|
||||
@@ -975,9 +973,16 @@ Site Navigation
|
||||
--------------------------------------------- */
|
||||
|
||||
.nav-primary {
|
||||
margin: 0 20px;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.nav-primary .genesis-nav-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-primary .genesis-nav-menu li {
|
||||
display: block;
|
||||
}
|
||||
@@ -1011,7 +1016,7 @@ Site Navigation
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.primary-nav .genesis-nav-menu ul ul a {
|
||||
.nav-primary .genesis-nav-menu ul ul a {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
@@ -1460,6 +1465,21 @@ Media Queries
|
||||
margin-right: 4rem;
|
||||
}
|
||||
|
||||
.archive-description {
|
||||
padding: 40px 40px 24px;
|
||||
padding: 4rem 4rem 2.4rem;
|
||||
}
|
||||
|
||||
.author-box {
|
||||
padding: 40px;
|
||||
padding: 4rem;
|
||||
}
|
||||
|
||||
.comment-respond, .entry-comments, .entry-pings {
|
||||
padding: 40px;
|
||||
padding: 4rem;
|
||||
}
|
||||
|
||||
.entry-footer .entry-meta {
|
||||
border-top: 2px solid #f5f5f5;
|
||||
margin: 0 -40px;
|
||||
|
||||
Reference in New Issue
Block a user