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!
look here: https://github.com/nikolas/pjax-menu hope it helps :)
EDIT : http://wordpress.org/extend/plugins/pjax-menu/
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.
Activate the plugin from the Plugins menu in your WordPress Dashboard.
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'
).
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()
{
}
);
}
);
Now when you see it works on a familiar theme, modify it to fit your needs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With