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.

In single.php, I have the following items that I manage (create, update, hide) with jquery/ajax:

  • a <select> tag in which I return all website categories.
  • a second <select> tag in which I return post titles depending on the selected category in first <select> tag.
  • a <div> tag which contains a content based on the selected post in second <select>. This content is divided into tabs. On click on a tab, I display via ajax a meta value of the custom field related to this tab for the specific post selected in second <select> . In addition, I am making a jquery pagination system for each tab whenever the meta value is long.

All jquery/ ajax actions are working like a charm respecting all rules of DOM updating and scripts reloading after triggering actions on updated DOM.

In sum, I have 4 parameters while navigating in single.php:

  • current category of post (returned by php).
  • current post id (returned automatically since we are in single.php).
  • current tab.
  • current page inside tab.

The problem is that I am actually including history.js to my website so that I can manage the history stack and the clicks on browser back-forward buttons.

Actually, the only URL structure I am having is:

mywebsite.com/?p=post_id

As you know, Wordpress allows navigating between posts by only changing p parameter, so this url structure is maintained during all navigation. And inside each post page, I can do further navigation via AJAX, but keeping the same post permalink in adress bar, which is not good for history management, SEO, bookmarking.....

How can I add the other 2 last parameters (current tab, current page) in an efficient way so that my URLs become like:

mywebsite.com/?p=post_id&tab=tab_number&pagi=pagi_number

Doing so, I think I can perform conditionnal tests inside History.Adapter.bind(window, 'statechange', function() {} so that I run history actions based on the values of the 3 parameters (current post_id, current_tab and current_page).

Do you have an idea or a better approach for doing such?

Making my website full jquery-ajaxified, respecting history and using wordpress is an issue that I am digging to resolve for a long time. Your help is really appreciated.

share|improve this question
    
We don't need a tag for a topic with just one question. :) –  toscho Apr 12 '13 at 3:18
    
are you sure sir ? why not to make a test by creating this tag and give some time to check how many beginner are asking how many questions about Wordpress and history.js –  whiteletters and blankspaces Apr 12 '13 at 13:32
    
Tags exists to group questions by concepts. Anyway, this belongs to WordPress Development Meta. –  toscho Apr 12 '13 at 13:35
2  
@lettersandblankspaces Please go through all questions, collect the ones that refer to the use of history.js, then add a question on Meta containing all those links. If you got more than 5, we will add it. Thanks for your patience. –  kaiser Apr 12 '13 at 13:38
    
aaah thanks kaiser, now I understand the procedure. –  whiteletters and blankspaces Apr 12 '13 at 13:40
show 4 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.