Coder Social home page Coder Social logo

wp-pjax's Introduction

#WP-PJAX - PJAX for Wordpress Plugin.

====== Makes your site faster and saves you a lot of bandwidth and CPU power by making your Wordpress site PJAX powered!

What is PJAX?

PJAX is a technique that uses ajax and pushState to deliver a fast browsing experience by only loading and updating parts of the page HTML. PushState makes it possible to simulate with real permalinks, page titles, and a working back button so that your visitors won't be able to tell the difference between PJAX page loads and ordinary full page loads, except for the increased speed of course.

Why PJAX?

It makes your site significantly faster and saves you both processing power and bandwidth!

Setting up the plugin

  1. In order for this to work you first need to make some changes to your theme.

1.1. Header. Put this line of code in the top of every header file(any header*.php file) in your theme(before any code or output)

if(function_exists( 'get_pjax_header' )) if(get_pjax_header()) return FALSE;

1.2. Footer. Put this line of code in the top of every footer file(any footer*.php file) in your theme(before any code or output)

if(function_exists( 'get_pjax_footer' )) if(get_pjax_footer()) return FALSE;

1.3. Sidebar. Put this line of code in the top of every sidebar file(any sidebar*.php file) in your theme(before any code or output)

if(function_exists( 'get_pjax_sidebar' )) if(get_pjax_sidebar()) return FALSE;
  1. Install and activate the plugin

  2. Configure the plugin and enable it. The configuration page can be found under WP-PJAX in the settings menu in WP-Admin. Instructions on how to configure is provided on the configuration page.

Compatibility and requirements

The goal is to make the plugin compatible with any theme with the minor modifications found under Setting up above. If you run into problems, please contact me and I will look info you problem to find a solution. The plguin is thoroughly tested on the TwentyTwelve theme and a few custom themes. This plugins is tested to run on PHP 5.2+ and WordPress 3.5+ but will probably run on older versions as well. Please report if your testing!

Actions & fitlers

All actions in order of typical execution:

wp_pjax_before_render - Triggered in the begining of get_pjax_header. Only runs on non-cached requests(the built in page cache). Parameters: Current post object.

wp_pjax_header - Triggered before the start of page template execution. Replaces wp_head. Typically for manupilating headers and page cache behaviour. Parameters (2): wp_pjax options.

wp_pjax_title - (filter) Used for generating the title

wp_pjax_footer - Triggered after page template execution. Replaces wp_footer. Parameters (2): current post object, wp_pjax options.

Please not that these actions are only triggered for PJAX/partial responses.

To-Do

  • Test in more themes
  • Add more multiple link/menu selectors with attached active CSS clases
  • Add support for several content areas. For example main content, sidebar, header and footer. Also support for custom updates of subsets(for example shopping cart).
  • Add support for search and form submit
  • Optimize performance on both client(JS) and server(content rendering). Revisit Cache implementation. Refresh/flush cache on page content update. Using local storage for client side cache?

Changelog

v0.1a

  • 2013-02-07: Initial commit - Still in early development - Very experimental!

Credits

This plugin is based on code form jQuery PJAX and Thematic PJAX

Inspiration from: Nathan Kontny's PJAX fork and PJAX Menu

wp-pjax's People

Watchers

James Cloos avatar Darek Nyckowiak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.