mirror of
https://github.com/10h30/trestle.git
synced 2026-06-05 15:09:35 +09:00
Merge branch 'BraadMartin-dev' into dev-test
This commit is contained in:
@@ -39,7 +39,6 @@ function trestle_custom_defaults( $defaults ) {
|
||||
'trestle_layout' => 'solid',
|
||||
'trestle_logo_url' => '',
|
||||
'trestle_logo_url_mobile' => '',
|
||||
'trestle_favicon_url' => '',
|
||||
'trestle_nav_primary_location' => 'full',
|
||||
'trestle_auto_nav' => 0,
|
||||
'trestle_auto_nav_depth' => 0,
|
||||
@@ -49,12 +48,6 @@ function trestle_custom_defaults( $defaults ) {
|
||||
'trestle_read_more_text' => __( 'Read More »', 'trestle' ),
|
||||
'trestle_revisions_number' => 3,
|
||||
'trestle_footer_widgets_number' => 3,
|
||||
'trestle_equal_height_cols' => 1,
|
||||
'trestle_equal_cols_breakpoint' => 768,
|
||||
'trestle_external_link_icons' => 1,
|
||||
'trestle_email_link_icons' => 1,
|
||||
'trestle_pdf_link_icons' => 1,
|
||||
'trestle_doc_link_icons' => 1,
|
||||
);
|
||||
|
||||
// Populate Trestle settings with default values if they don't yet exist
|
||||
@@ -107,7 +100,6 @@ function trestle_register_social_sanitization_filters() {
|
||||
'trestle_auto_nav_depth',
|
||||
'trestle_revisions_number',
|
||||
'trestle_footer_widgets_number',
|
||||
'trestle_equal_cols_breakpoint',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -128,7 +120,6 @@ function trestle_register_social_sanitization_filters() {
|
||||
array(
|
||||
'trestle_logo_url',
|
||||
'trestle_logo_url_mobile',
|
||||
'trestle_favicon_url',
|
||||
'trestle_home_link_text',
|
||||
'trestle_nav_button_text',
|
||||
'trestle_custom_nav_extras_text',
|
||||
@@ -173,7 +164,7 @@ function trestle_settings_box() {
|
||||
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="bubble" <?php checked( esc_attr( genesis_get_option( 'trestle_layout' ) ), 'bubble' ); ?> />
|
||||
</p>
|
||||
|
||||
<h4><?php _e( 'Logos & Favicon', 'trestle' ) ?></h4>
|
||||
<h4><?php _e( 'Header', 'trestle' ) ?></h4>
|
||||
<p>
|
||||
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]"><?php _e( 'Logo URL', 'trestle' ); ?></label><br />
|
||||
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]" value="<?php echo esc_attr( genesis_get_option( 'trestle_logo_url' ) ); ?>" />
|
||||
@@ -182,11 +173,6 @@ function trestle_settings_box() {
|
||||
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]"><?php _e( 'Mobile Logo URL', 'trestle' ); ?></label><br />
|
||||
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]" value="<?php echo esc_attr( genesis_get_option( 'trestle_logo_url_mobile' ) ); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_favicon_url]"><?php _e( 'Favicon URL', 'trestle' ); ?></label><br />
|
||||
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_favicon_url]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_favicon_url]" value="<?php echo esc_attr( genesis_get_option( 'trestle_favicon_url' ) ); ?>" />
|
||||
<span class="description"><?php _e( 'Defaults to <i>/wp-content/themes/trestle/images/favicon.ico</i> if not specified.', 'trestle' ); ?></span>
|
||||
</p>
|
||||
|
||||
<h4><?php _e( 'Primary Navigation', 'trestle' ) ?></h4>
|
||||
<p>
|
||||
@@ -314,15 +300,6 @@ function trestle_settings_box() {
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<h4><?php _e( 'Genesis Extender Plugin', 'trestle' ) ?></h4>
|
||||
<p>
|
||||
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_height_cols]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_height_cols]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_equal_height_cols' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_height_cols]"><?php _e( 'Automatically equalize height of Genesis Extender homepage columns', 'trestle' ); ?></label>
|
||||
</p>
|
||||
<p class="trestle-equal-columns-breakpoint">
|
||||
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_cols_breakpoint]"><?php _e( 'Implement at', 'trestle' ); ?><input type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_cols_breakpoint]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_equal_cols_breakpoint]" value="<?php echo esc_attr( genesis_get_option( 'trestle_equal_cols_breakpoint' ) ); ?>" size="4"/>px <?php _e( 'and wider (should match main CSS breakpoint)', 'trestle' ); ?></label>
|
||||
</p>
|
||||
|
||||
<h4><?php _e( 'Link Icons', 'trestle' ) ?></h4>
|
||||
<p>
|
||||
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_external_link_icons' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]"><?php _e( 'Add icons to external links', 'trestle' ); ?></label><br />
|
||||
@@ -347,6 +324,12 @@ add_action( 'tgmpa_register', 'trestle_register_required_plugins' );
|
||||
function trestle_register_required_plugins() {
|
||||
$plugins = array(
|
||||
// Required plugins
|
||||
array(
|
||||
'name' => 'Better Font Awesome',
|
||||
'slug' => 'better-font-awesome',
|
||||
'required' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'Respond.js',
|
||||
'slug' => 'respondjs',
|
||||
@@ -379,8 +362,8 @@ function trestle_register_required_plugins() {
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'Easy Fancybox',
|
||||
'slug' => 'easy-fancybox',
|
||||
'name' => 'FancyBox for WordPress',
|
||||
'slug' => 'fancybox-for-wordpress',
|
||||
'required' => false,
|
||||
),
|
||||
|
||||
|
||||
@@ -70,12 +70,6 @@ function trestle_header_actions() {
|
||||
if ( is_readable( $upload_path . $custom_js_file ) )
|
||||
wp_enqueue_script( 'trestle-custom-jquery', $upload_url . $custom_js_file, array( 'jquery' ), CHILD_THEME_VERSION, true );
|
||||
|
||||
// Pass PHP variables to theme jQuery
|
||||
$php_vars = array (
|
||||
'trestle_equal_cols_breakpoint' => genesis_get_option( 'trestle_equal_cols_breakpoint' ),
|
||||
);
|
||||
wp_localize_script( 'theme-jquery', 'trestle_vars', $php_vars );
|
||||
|
||||
}
|
||||
|
||||
add_filter( 'genesis_pre_load_favicon', 'trestle_do_custom_favicon' );
|
||||
|
||||
+95
-149
@@ -7,188 +7,134 @@
|
||||
*/
|
||||
|
||||
// Executes when the document is ready
|
||||
jQuery(document).ready(function( $ ) {
|
||||
|
||||
// Get PHP vars passed via wp_localize_script()
|
||||
trestleEqualColsBreakpoint = trestle_vars.trestle_equal_cols_breakpoint;
|
||||
trestleEqualHeightCols = trestle_vars.trestle_equal_height_cols;
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
// Remove .no-jquery body class
|
||||
$('body').removeClass('no-jquery');
|
||||
|
||||
$( 'body' ).removeClass( 'no-jquery' );
|
||||
|
||||
// External Links
|
||||
var h = window.location.host.toLowerCase();
|
||||
$('[href^="http"]').not('[href*="' + h + '"]').addClass('external-link').attr("target", "_blank");
|
||||
$( '[href^="http"]' ).not( '[href*="' + h + '"]' ).addClass( 'external-link' ).attr( "target", "_blank" );
|
||||
|
||||
// Add classes to different types of links
|
||||
$('a[href^="mailto:"]').addClass('email-link');
|
||||
$('a[href*=".pdf"]').attr({"target":"_blank"}).addClass('pdf-link');
|
||||
$('a[href*=".doc"]').attr({"target":"_blank"}).addClass('doc-link');
|
||||
$('a').has('img').addClass('image-link');
|
||||
$( 'a[href^="mailto:"]' ).addClass( 'email-link' );
|
||||
$( 'a[href$=".pdf"]' ).attr({ "target":"_blank" }).addClass( 'pdf-link' );
|
||||
$( 'a[href$=".doc"]' ).attr({ "target":"_blank" }).addClass( 'doc-link' );
|
||||
$( 'a' ).has( 'img' ).addClass( 'image-link' );
|
||||
|
||||
// Add classes to parts of lists
|
||||
$('li:last-child').addClass('last');
|
||||
$('li:first-child').addClass('first');
|
||||
$('ul, ol').parent('li').addClass('parent');
|
||||
$( 'li:last-child' ).addClass( 'last' );
|
||||
$( 'li:first-child' ).addClass( 'first' );
|
||||
$( 'ul, ol' ).parent( 'li' ).addClass( 'parent' );
|
||||
|
||||
// Mobile header toggle buttons
|
||||
$('.site-header .title-area').after('<div class="toggle-buttons" />');
|
||||
$('.site-header .widget-area, .nav-primary').each(function(i) {
|
||||
var target = $(this);
|
||||
$( '.site-header .title-area' ).after( '<div class="toggle-buttons" />' );
|
||||
$( '.site-header .widget-area, .nav-primary' ).each( function( i ) {
|
||||
|
||||
var buttonClass = 'toggle-button';
|
||||
// Store target
|
||||
$target = $( this );
|
||||
|
||||
// Add classes of target element
|
||||
var targetClass = target.attr('class').split(/\s+/);
|
||||
$.each(targetClass, function(index,value) {
|
||||
buttonClass += ' targets-' + value;
|
||||
});
|
||||
|
||||
if ( $(this).is( 'nav' ) ) {
|
||||
buttonClass += ' nav-toggle';
|
||||
}
|
||||
// Scope variables
|
||||
var $target, buttonClass, targetClass;
|
||||
|
||||
// Add toggle buttons to header
|
||||
$('.toggle-buttons').prepend('<a id="toggle-button-' + i + '" class="' + buttonClass + '" href="#">Toggle</a>');
|
||||
// Setup classes
|
||||
buttonClass = 'toggle-button';
|
||||
targetClass = $target.attr( 'class' ).split( /\s+/ );
|
||||
|
||||
// Add target class to nav and widget areas
|
||||
target.addClass('toggle-target-' + i );
|
||||
});
|
||||
|
||||
// Toggle widget areas and primary nav
|
||||
$('.site-header .toggle-button').click( function( event ) {
|
||||
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
// Add targets-[] class to buttonClass
|
||||
$.each( targetClass, function( index, value ) {
|
||||
buttonClass += ' targets-' + value;
|
||||
});
|
||||
|
||||
// Get toggle button that was clicked
|
||||
var button = $(this);
|
||||
// Add nav-toggle class to buttonClass if the button is for the nav
|
||||
if ( $target.is( 'nav' ) ) {
|
||||
buttonClass += ' nav-toggle';
|
||||
}
|
||||
|
||||
// Remove focus
|
||||
button.blur();
|
||||
// Add toggle buttons to header
|
||||
$( '.toggle-buttons' ).prepend( '<a id="toggle-button-' + i + '" class="' + buttonClass + '" href="#">Toggle</a>' );
|
||||
|
||||
var target = $( '.toggle-target-' + button.attr('id').match(/\d+/) );
|
||||
// Add target class to nav and widget areas
|
||||
$target.addClass( 'toggle-target-' + i );
|
||||
});
|
||||
|
||||
// Toggle buttons
|
||||
button.toggleClass('open');
|
||||
$('.site-header .toggle-button').not(button).removeClass('open');
|
||||
// Toggle widget areas and primary nav
|
||||
$( '.site-header .toggle-button' ).click( function( event ) {
|
||||
|
||||
// Toggle targets
|
||||
target.toggleClass('open');
|
||||
$('[class*="toggle-target"]').not(target).removeClass('open');
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
|
||||
});
|
||||
// Scope our variables
|
||||
var $button, $target;
|
||||
|
||||
// Mobile navigation icons
|
||||
var closedIcon = '+';
|
||||
var openIcon = '-';
|
||||
// Get toggle button that was clicked
|
||||
$button = $( this );
|
||||
|
||||
$('.nav-primary').find('.genesis-nav-menu .parent:not(.current-menu-item, .current_page_item, .current_page_parent, .current_page_ancestor) > a').after('<a class="sub-icon" href="#">' + closedIcon + '</a>');
|
||||
$('.nav-primary').find('.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="#">' + openIcon + '</a>');
|
||||
|
||||
// Mobile navigation expand/contract functionality
|
||||
$('.sub-icon').click(function(event) {
|
||||
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
|
||||
// Get icon clicked
|
||||
var icon = $(this);
|
||||
//Remove focus
|
||||
$button.blur();
|
||||
|
||||
// Remove focus
|
||||
icon.blur();
|
||||
// Match the button to the right target
|
||||
$target = $( '.toggle-target-' + $button.attr( 'id' ).match( /\d+/ ) );
|
||||
|
||||
icon.next('ul').slideToggle().toggleClass('open');
|
||||
if ( icon.text().indexOf( closedIcon ) !== -1 )
|
||||
icon.text(openIcon);
|
||||
else if ( icon.text().indexOf( openIcon ) !== -1 )
|
||||
icon.text(closedIcon);
|
||||
});
|
||||
|
||||
$('.widget-area-toggle').click(function(event) {
|
||||
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
// Toggle buttons
|
||||
$button.toggleClass( 'open' );
|
||||
$( '.site-header .toggle-button' ).not( $button ).removeClass( 'open' );
|
||||
|
||||
// Get button clicked
|
||||
var button = $(this);
|
||||
|
||||
// Remove focus
|
||||
button.blur();
|
||||
|
||||
button.toggleClass('open');
|
||||
button.next('.widget-area').slideToggle();
|
||||
});
|
||||
|
||||
// Equal height homepage cols
|
||||
$('.equal-height-genesis-extender-cols .ez-home-container-area').each(function() {
|
||||
$(this).children('.widget-area').equalHeights(null,null,trestleEqualColsBreakpoint);
|
||||
// Toggle targets
|
||||
$target.toggleClass( 'open' );
|
||||
$( '[class^="toggle-target"]' ).not( $target ).removeClass( 'open' );
|
||||
});
|
||||
|
||||
|
||||
}); /* end of as page load scripts */
|
||||
// Mobile navigation icons
|
||||
var closedIcon = '+';
|
||||
var openIcon = '-';
|
||||
|
||||
// Insert the icons into the nav where appropriate
|
||||
$( '.nav-primary' ).find( '.genesis-nav-menu .parent:not( .current-menu-item, .current_page_item, .current_page_parent, .current_page_ancestor) > a' ).after( '<a class="sub-icon" href="#">' + closedIcon + '</a>' );
|
||||
$( '.nav-primary' ).find( '.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="#">' + openIcon + '</a>' );
|
||||
|
||||
// Executes when complete page is fully loaded, including all frames, objects, and images
|
||||
jQuery(window).load(function( $ ) {
|
||||
// Mobile navigation expand/contract functionality
|
||||
$( '.sub-icon' ).click( function( event ) {
|
||||
|
||||
});
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
|
||||
// Get icon click
|
||||
var $icon = $( this );
|
||||
|
||||
/**
|
||||
* Equal Heights Plugin
|
||||
*
|
||||
* Equalize the heights of elements. Great for columns or any elements
|
||||
* that need to be the same size (floats, etc).
|
||||
*
|
||||
* Based on Rob Glazebrook's (cssnewbie.com) script
|
||||
*
|
||||
* Additions
|
||||
* - ability to include a break point (the minimum viewport width at which the script does anything)
|
||||
* - binds the script to run on load, orientation change (for mobile), and when resizing the window
|
||||
*
|
||||
* Usage: jQuery(object).equalHeights([minHeight], [maxHeight], [breakPoint]);
|
||||
*
|
||||
* Example 1: jQuery(".cols").equalHeights(); Sets all columns to the same height.
|
||||
* Example 2: jQuery(".cols").equalHeights(400); Sets all cols to at least 400px tall.
|
||||
* Example 3: jQuery(".cols").equalHeights(100,300); Cols are at least 100 but no more
|
||||
* than 300 pixels tall. Elements with too much content will gain a scrollbar.
|
||||
* Example 4: jQuery(".cols").equalHeights(null, null,768); Only resize columns above 768px viewport
|
||||
*
|
||||
*/
|
||||
(function( $ ) {
|
||||
$.fn.equalHeights = function(minHeight, maxHeight, breakPoint) {
|
||||
var items = this;
|
||||
breakPoint = breakPoint || 0;
|
||||
// Remove focus
|
||||
$icon.blur();
|
||||
|
||||
// Bind functionality to appropriate events
|
||||
$(window).on('load orientationchange resize equalheights', function() {
|
||||
tallest = (minHeight) ? minHeight : 0;
|
||||
items.each(function() {
|
||||
$(this).height('auto');
|
||||
if($(this).outerHeight() > tallest) {
|
||||
tallest = $(this).outerHeight();
|
||||
}
|
||||
});
|
||||
// Expand/contract
|
||||
$icon.next( 'ul' ).slideToggle().toggleClass( 'open' );
|
||||
|
||||
// Get viewport width (taking scrollbars into account)
|
||||
var e = window;
|
||||
a = 'inner';
|
||||
if (!('innerWidth' in window )) {
|
||||
a = 'client';
|
||||
e = document.documentElement || document.body;
|
||||
}
|
||||
width = e[ a+'Width' ];
|
||||
// Change the icon to indicate open/closed
|
||||
if ( $icon.text().indexOf( closedIcon ) !== -1 ) {
|
||||
$icon.text( openIcon );
|
||||
} else if ( $icon.text().indexOf( openIcon ) !== -1 ) {
|
||||
$icon.text( closedIcon );
|
||||
}
|
||||
});
|
||||
|
||||
// Equalize column heights if above the specified breakpoint
|
||||
if ( width >= breakPoint ) {
|
||||
if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
|
||||
console.log(tallest);
|
||||
return items.each(function() {
|
||||
$(this).height(tallest);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// Header widget area expand/contract functionality
|
||||
$( '.widget-area-toggle' ).click( function( event ) {
|
||||
|
||||
})(jQuery);
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
|
||||
// Get button clicked
|
||||
var $button = $( this );
|
||||
|
||||
// Remove focus
|
||||
$button.blur();
|
||||
|
||||
// Expand/contract
|
||||
$button.toggleClass( 'open' ).next( '.widget-area' ).slideToggle();
|
||||
});
|
||||
|
||||
// Executes when complete page is fully loaded, including all frames, objects, and images
|
||||
$( window ).on( 'load', function() {
|
||||
|
||||
});
|
||||
|
||||
}); /* end of page load scripts */
|
||||
Reference in New Issue
Block a user