Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using ajax in a theme not written by me. This ajax gets the link clicked and then slides that page into view. it works good. In order for it to do it's thing, I had to make a custom walker for wp_nav_menu that adds two characters to the link so my links look like this in the nav

 http://my-site.com/#!/post-1

my problem with this is that when viewing a single page. I have to have WordPress reload the page to get the single post. So then my link would look like this

 http://my-site.com/?p=post-1

So when I hover over the nav to go back to a previous or new page, this is where my problem starts. my nav shows this as the selection when clicked

 http://my-site.com/?p=post-1#!/post-1

I don't know why it won't get rid of the previous address. Here is my custom walker http://pastebin.com/Xn7NRiG7

Most of the site is is loading posts and pages into the index and then using the ajax to scroll that page into view. I am trying to make the single blog pages external to the ajax functionality. I tried using two different menus for this like so

 if( is_home() || is_page()){
           $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '<span></span><strong>','link_after' => '</strong>', 'theme_location' => 'primary','walker' => new Amaranthe_Custom_Walker_Nav_Sub_Menu());
            wp_nav_menu($args);
        } else {
           $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '<span></span><strong>','link_after' => '</strong>', 'theme_location' => 'primary');
            wp_nav_menu($args);
        } ?>

Do you have any idea how I might be able to get back into the ajax flow properly?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

I solved this issue by adding this code to my walker

    if( !is_home()){
    $item->url = get_bloginfo('url')."/#!/page_".$temp_url;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.