diff --git a/includes/admin/admin.php b/includes/admin/admin.php index 3628874..ae6b9f3 100644 --- a/includes/admin/admin.php +++ b/includes/admin/admin.php @@ -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() { />

-

+


@@ -182,11 +173,6 @@ function trestle_settings_box() {

-

-
- - /wp-content/themes/trestle/images/favicon.ico if not specified.', 'trestle' ); ?> -

@@ -314,15 +300,6 @@ function trestle_settings_box() { ?>

- -

-

- /> -

-

- -

-

/>
@@ -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, ), diff --git a/includes/functions/theme-functions.php b/includes/functions/theme-functions.php index cb0936f..3965264 100644 --- a/includes/functions/theme-functions.php +++ b/includes/functions/theme-functions.php @@ -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' ); diff --git a/includes/js/theme-jquery.js b/includes/js/theme-jquery.js index 71ff524..6072145 100644 --- a/includes/js/theme-jquery.js +++ b/includes/js/theme-jquery.js @@ -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('

'); - $('.site-header .widget-area, .nav-primary').each(function(i) { - var target = $(this); + $( '.site-header .title-area' ).after( '
' ); + $( '.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('Toggle'); + // 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( 'Toggle' ); - 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('' + closedIcon + ''); - $('.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('' + openIcon + ''); - - // 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( '' + closedIcon + '' ); + $( '.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( '' + openIcon + '' ); -// 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 */ \ No newline at end of file