Page Load Ajax

Description

The purpose of this plugin is to minimize page load time and resource usage by updating the page title and content only rather then reloading the entire webpage.
The new contents and titles are fetched by ajax calls.

Restriction:
As the rest of the page like header including all styles and scripts, footer and sidebars are not affected, you should only use this to switch between pages with the same overall layout and requirements.

You can enter shortcodes in the page content that will show up as a button or a text link.
When activating the link, the pages title and content will be replaced by the title and content of the specified page.

There are four possible independant arguments to the shortcode:
– page (required). This can be the page title or the page id.
– text (optional). The button text or textlink text.
– title-elm (optional). The title element id or class if it is not the default as entered on the settings page.
– content-elm (optional). The content element id or class if not default.

Examples: [pla page=”Tet page”] [pla page=”5″ text=”Go to the testpage”] [pla page=”My Page” content-elm=”#my-div”]

Installation

After standard installation, one should specify the preferences on the WP Settings -> Page Load Ajax settings admin page.
It is important to know the html element id or class of the page title and page content. This is dependant of the theme being used.
Id’s should be prefixed by a hashtag (#) and classes by a dot (.) when specifying these settings.
IMPORTANT: After installation: go to the WP Settings -> Permalinks admin page and acitvate the Save Changes button, even when you did not changed anything.

Reviews

November 12, 2021
I've been trying to wrap my head around loading content into a specfic div from other pages, without actually refreshing the page. Wanted to use Ajax, but being the rookie I am, I never managed to do it. This did the trick! Great little plugin.
Read all 2 reviews

Contributors & Developers

“Page Load Ajax” is open source software. The following people have contributed to this plugin.

Contributors

“Page Load Ajax” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “Page Load Ajax” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0

  • Initial release.

1.1

  • Added do_shortcode filter to widget text to enable [pla] shortcdes in widgets to create pseudo menus.

1.2

  • It is no longer required to save the setup -> permalink admin page after installation.

1.4

  • Added menu interface. You can now let your menu items work like PLA buttons.
    To activate, you need two tings to do: Tick the box ‘Convert menu’ on the pla settings page,
    and modify your theme, so the PLA menu walker will be actvated.
    Example:

Change:

    <?php
        wp_nav_menu( ['theme_location' => 'primary'] );
    ?>

Into:

    <?php
        $args = array();
        $args['theme_location'] = 'primary';

        // Add pla menu walker only when pla is activated
        if ( class_exists( 'PLA_Menu_Walker' ) ) {
            $args['walker'] = new PLA_Menu_Walker();
        }
        wp_nav_menu( $args );
    ?>
  • Added custom code. After the new content has been loaded to the page, a custom js function may be called to execute any js code.
    Write your custom js function and activate it e.g. by entering it in plugin Simple Custom CSS and JS.
    Your function should have the name plaCustomFunction() and supports one argument being the current page id.
    Example that makes an element be hidden on page 13 and shown otherwise:

    <script>
        function plaCustomFunction( id ) {
    
            if ( id == 13 ) {
                jQuery( '#MyDemoElm' ).hide();
            }
            else {
                jQuery( '#MyDemoElm' ).show();
            }
        };
    </script>