3
50
4K
0
10 April 2024
06 May 2021
Based on 3 on WordPress.org
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>
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.