Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress is_page failing in responsive design

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44467
    iamshawnrice
    Participant

    I am running into a very odd bug here:
    http://dppad.com/dev/3/about/

    I am trying to add a ‘current’ state to the nav item reflecting the current page. It’s successful on the full and tablet versions of the menu (contained in header.php), but the mobile version (in footer.php) is only giving me luck on one of the pages.

    Any thoughts are greatly appreciated.

    footer.php:
    http://pastebin.com/2ZjP9BCU

    header.php:
    http://pastebin.com/tPUNNU1r

    #133641
    TheDoc
    Member

    There’s likely some sort of loop problem occurring. Try resetting your query before your footer nav.

    #134455
    iamshawnrice
    Participant

    Copy that. I worked out a fairly simple solution via jQuery utilizing WordPress’s native namespacing:

    function mobileCurrentPage() {
    var page = $(‘body’);

    if ( page.hasClass(‘page-id-54’) ) {
    $(‘.about_link a’).addClass(‘current’);
    $(‘.bios_link a’).removeClass(‘current’);
    }

    else if ( page.hasClass(‘page-id-42’) || page.hasClass(‘single-case_study’) ) {
    $(‘.results_link a’).addClass(‘current’);
    }

    else if ( page.hasClass(‘page-id-80’) || page.hasClass(‘single-post’) ) {
    $(‘.blog_link a’).addClass(‘current’);
    }

    else if ( page.hasClass(‘page-id-485’) ) {
    $(‘.connect_link a’).addClass(‘current’);
    }

    else {
    }
    }

    It felt a little like giving up, but a solution’s a solution in my book.

    Thanks for the reply.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.