5 Commits

Author SHA1 Message Date
MickeyKay 20e9f40b57 Convert spaces to tabs. 2015-07-24 16:09:46 -07:00
MickeyKay 7d004ef9f0 Add helper function to check if post is current or descendent. 2015-07-24 16:01:24 -07:00
Mickey Kay 51c177d85a Merge pull request #34 from MIGHTYminnow/fix/mobile-menu-jquery
Update jQuery to add +/- signs to mobile menu. Fixes #33.
2015-07-20 13:52:37 -05:00
Mickey Kay 69184c5f90 Merge pull request #36 from MIGHTYminnow/feature/add-img-check-function
Feature/add img check function
2015-07-20 13:36:07 -05:00
MickeyKay a6b0a37771 Update jQuery to add +/- signs to mobile menu. Fixes #33. 2015-07-06 11:59:03 -07:00
2 changed files with 28 additions and 2 deletions
+26
View File
@@ -457,3 +457,29 @@ function trestle_image_has_size( $image_id, $image_size = null ) {
return false;
}
/**
* Check if post is, or is a child of, a target post.
*
* @since 1.0.0
*
* @param string $post_id Post ID to check.
* @param string $target_id Target post ID to check against.
*
* @return true|false
*/
function trestle_is_current_or_descendant_post( $post_id = '', $target_id = '' ) {
// If the current post is the target post, return true.
if ( $post_id == $target_id ) {
return true;
}
// If the current post is a descendant of the target post.
if ( in_array( $target_id, get_post_ancestors( $post_id ) ) ) {
return true;
}
return false;
}
+2 -2
View File
@@ -107,8 +107,8 @@ jQuery( document ).ready( function( $ ) {
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>' );
$( '.nav-primary' ).find( '.genesis-nav-menu .parent:not( [class*="current"] ) > a' ).after( '<a class="sub-icon" href="#">' + closedIcon + '</a>' );
$( '.nav-primary' ).find( '.genesis-nav-menu .parent[class*="current"] > a' ).after( '<a class="sub-icon" href="#">' + openIcon + '</a>' );
// Mobile navigation expand/contract functionality.
$( '.sub-icon' ).click( function( event ) {