Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using PJAX in Wordpress

I'm trying to integrate PJAX into my Wordpress install, and here's the code I am using for it:

<script src="js/jquery.pjax.js"></script>
<script type="text/javascript">
    $(function(){
        // pjax
        $('ul a').pjax('#middlewrap')
    })
</script>

I am just following the demo they have on the PJAX demo page, but replacing the container they used (#main) with the one for my Wordpress theme, which was #middlewrap.

I don't see any weird errors on the console, but it doesn't work either. Appreciate any help!

like image 558
JonLim Avatar asked Aug 21 '11 17:08

JonLim


2 Answers

look here: https://github.com/nikolas/pjax-menu hope it helps :)

EDIT : http://wordpress.org/extend/plugins/pjax-menu/

like image 195
MechanisM Avatar answered Oct 05 '22 06:10

MechanisM


  1. Download pjax menu plugin for wordpress.
  2. The archive you download will have a folder named nikolas-pjax-menu-XXXXXXX, copy that folder to your wordpress application's plugins folder

    /your-wordpress-app-root/wp-content/plugins/

    while renaming it to pjax-menu for example.

  3. Activate the plugin from the Plugins menu in your WordPress Dashboard.

  4. Edit the javascript file

    /your-wordpress-app-root/wp-content/plugins/pjax-menu/pjax_menu.js

    to accommodate your links (for example: '#access .menu a') and content main container ('#main').

  5. I used the following code on WordPress' Twenty Eleven theme v1.2:

    var $j = jQuery;
    $j(document).ready
    (
        function()
        {
            $j('#access .menu a').pjax('#main').live
            (
               'click',
                function()
                {
                }
            );
        }
    );
    
  6. Now when you see it works on a familiar theme, modify it to fit your needs

like image 22
Miljenko Barbir Avatar answered Oct 05 '22 05:10

Miljenko Barbir