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.

This website: http://www.ericpaulsnowden.com

(The website is done in Wordpress).

Loads pages and posts dynamically with AJAX/jQuery.

Does anybody know how to do this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I do, it's my site :) Here it is at a high level

1) I built the site as a standard html/css/javascript site without ajax and without Wordpress code. Layout complete without content. All links are regular a href links - this helps with backwards compatibility later.

2) Added in the Wordpress code to pull in content without ajax. Make sure all content is wrapped in a consistent div, which I call container.

3) I use jQuery to hijack all clicks on a href links. If there isn't target="_blank" or a class of override I then load the page using ajax. I grab the url, look for the div of container (defined above) and load just that content keeping the header and footer consistent. I also use JQuery address to change the url and title of the page.

4) When the content is finished loading I fire jQuery calls to fade in the content and reposition the bar under the nav. I also make additional calls to add any page specific JS back in as it gets stripped out by loading the page via ajax.

5) Finally I modified my .htaccess file to add a www. to every page and added javascript into the header of my file to add the hash into the url more jQuery address code to load the proper page if someone deep links.

Hope some of this helps!

Eric

share|improve this answer
    
Oh what a coincidence! You just saw my question. –  janoChen Aug 22 '11 at 10:05
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.