Setting up wordpress in your local system


Easy Wordpress Installation for Novice in wordpress:

Download wordpress from http://wordpress.org/download/

Install Lamp/Wamp/Xampp any hosting server on your local machine and run the server.

Make sure the url http://localhost/ works and shows some page in browser.

Copy the downloaded wordpress folder to /var/www (for apache) or any other directory depending on the root of your server(i.e. the directory where your localhost points to)

Now you can hit the Url http://localhost/wordpress/ and it should work if you copied the code properly 

Assuming you have installed mysql (during installation of LAMP) or any database client, you can create a new database to be used for wordpress or you may want to use an existing one.    eg.Suppose i created a test database and hence will use it for wordpress. 

Now in the form you can follow instructions shown on page http://localhost/wordpress/ and configure the server and create title, give username, password to create wp-config.php .It will automatically create table in your selected database for you.

Or else you can just go to wp-config-sample.php and modify and rename it

After this when you hit the url again you should be able to see your blog site and the first post.

You can modify and create new post by going to http://localhost/wordpress/wp-admin

Using Pjax to make page navigation user friendly



Understanding this, requires a little knowledge of Javascript, Jquery and Ajax. Pjax is nothing more but an extension of Ajax with the support of push state.

First of let us understand what is page navigation, when ever user encounters a page link which may be a different page in the same site using , he is redirected to that page. It basically means content of the current page are removed and that page are loaded along with all the javacript and css, which may not be different from current page, (it may not be so if we take browser caching into consideration).

But again the point here is that using pjax this complete action can be avoided and only the required content which changes, could be loaded(which is exactly what happens in ajax), but with the difference that url will also change, and user understands this a different page, and he can use back and forward button as if the page has actually navigated.

You can see the complete working demo here.
Now how do we do it. Very basic and simplest method :
  • Include Jquery and Pjax file in your script files.
  • you can use normal href links, but in javascript you have to use jquery. eg.


    $('a').click(function(e){
     window.pjax.fetch($(this).attr('href'),'body#id');
    // body#id is the body element id where the content should be fetched to
    });



Also Note that the body id for pjax needs to be present in both the pages i.e. the current page, and the new page. Basically behind the scene the content of body#id from new page will replace content of body#id in the current page. That's it. Happy Pjaxing!!