1

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?

0

I solved this issue by adding this code to my walker

    if( !is_home()){
    $item->url = get_bloginfo('url')."/#!/page_".$temp_url;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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