Grow your CSS skills. Land your dream job.

wordpress nav issue (advanced)

  • # February 19, 2013 at 10:14 pm

    I have a custom walker for my WordPress navigation. I am trying to make a one page wordpress site but I ran into trouble trying to get single pages working so I decided to just go ahead and reload the page to display the single pages. So my custom walker adds characters to the navigation to make it work. So it looks like this

    http://mysite.com/#!/post1

    When I click on a permalink, it changes to the standard link

    http://mysite.com/?p=post1

    My problem is that when I try to go to another page, the old address does not go away. So instead of getting

    http://mysite.com/#!/about

    I get this

    http://mysite.com/?p=post1#!/about

    my custom walker
    http://pastebin.com/Xn7NRiG7

    On a side note. Does anyone know of any tutorials on making a one page wordpress site? I have been finding it to be very difficult.

    # February 20, 2013 at 2:46 pm

    In terms of creating a WordPress site without page reloading (using `window.location.hash`), check out: http://css-tricks.com/video-screencasts/81-ajaxing-a-wordpress-theme/.

    In terms of the hash not being removed when you go to another page, I think you need to reset it back to null in your JavaScript if there is a query string in the URI. For example:

    if(window.location.pathname.indexOf(‘?p=’) != -1) {
    window.location.hash = null
    }

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".