You can “initialize” the script any time after it has been loaded on the page. I usually do that in wp_footer
(Especially if you enqueue the script in the footer) but you can add it to wp_head
too.
add_action( 'wp_footer', 'wpa_107420_footer_script' );
function wpa_107420_footer_script(){ ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
// Stuff to do as soon as the DOM is ready;
var jPM = $.jPanelMenu({
menu: '#custom-menu-selector',
trigger: '.custom-menu-trigger-selector'
});
});
</script>
}
You’ll need to modify the script part per the instructions on the jPanelMenu plugin. That part’s off-topic here, but this is how you’d add the script to WordPress.
Related Posts:
- can’t add EVENT LISTENER to a element
- wp_nav_menu(), how to change class?
- pass object/JSON to wp_localize_script
- Add custom classes to anchor in wp_nav_menu
- Strict Standards Error bootstrap navwalker
- How to alter the text of the post “Excerpt” box label in WordPress post editor?
- How to add menu support to a theme?
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- How to add a section to the menus configuration, offering hard coded items?
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to Change CSS Variable value in Theme Customizer Live Preview
- Extend walker – navigation, adding data attribute to a tag
- WordPress Google Maps in Custom Theme
- Displaying wp menus by name without using theme locations
- how to change WordPress menu markup/classes
- Setting a Default ‘Theme Location’ When Creating a Menu
- wp_enqueue_script being ignored in custom theme
- Getting jquery to work with custom theme
- Adding wp_enqueue_media(); causes problem
- How to correctly add JQuery in a WP theme?
- How to add categories to wp_list_pages()
- .sub-menu or .children?
- Toggle Sidebar Display
- Including Javascript options
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Fancy-box Esay wordpress plugin fails to work on Multilingual site
- Arguments ignored/markup changed in wp_nav_menu if no menu is selected
- WP 3.1 upgrade breaks AutoFocus+ theme
- Difficulty loading jQuery with wp_enqueue_script
- My Admin bar covers my sticky navbar [closed]
- jQuery not available to other scripts
- My javascript jquery won’t work?
- WordPress is adding margins and padding to my custom menu?
- Primary navigation menu & footer not showing in category / tag page
- Using a page as home, how do I prevent nav from setting both home and page links active?
- Implementing FancyBox
- Custom markup with wp_nav_menu based on pages
- How to: JQuery multiple wordpress media uploader buttons in the same options page?
- Post thumbnail to append post content via ajax click event
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Using page-id-{ID} from body_class() in local dev, versus live staging
- My jQuery is enqueued properly. So why isn’t it working?
- Custom theme, contact form 7 & fast secure form doesn’t work
- Get the amount of posts on a given page
- Javascipt issue on custom theme
- How to make javascript work on theme options page
- JQuery undefined and Stylesheet loads in bottom along with js files
- Weirdness in jQuery supplied with WordPress
- how do i develop a global nav and local nav to be wordpress dynamic?
- jQuery from parent theme loaded with many other scripts in a single min.js file
- Theme development: menu links a tabbed page with page jumps
- Trouble in enquing all js files under certain directory
- how to hide home nav link in wordpress
- Seeting Active Nav for Bootstrap in WordPress
- Custom nav menu not showing
- How do I display a greyed out next_post_link when there is no next post
- loading javascript after jquery is loaded
- MapPress Easy Google Map in Jquery Tabs Problem
- I don’t think WordPress is loading jquery or bootstrap js
- how can i remove js file from my footer in wordpress
- How to properly use AWS SES for a contact form?
- Programatically Created Menu not Editable in Dashboard
- Does single webpage do not need navigation to create a slug in permalink?
- White screen of death on index.php page 3 and above?
- 3 Level Menu Navigation (3rd Level not displaying)
- Embedding CodePen Calorie Script – jquery error
- How to load jQuery with Ajax in WP version 5.3.2?
- How to enqueue scripts properly with ES6 webpack?
- Infinite scroll without plugin using ajax
- How can I show a custom WordPress menu anywhere I want on my website?
- change background image on scroll
- Show all menu levels except top level. How to exclude top level of a menu?
- WordPress Menu item > Sub menu Class update
- Move the social media icons to the left of a WordPress nav menu for Soledad child Theme
- Need help with adding custom wordpress menu and sub-menu
- How to achieve this navigation style in wordpress navigation
- how to add jquery to wordpress
- Fallback dosen’t work when not using ‘menu’ attribute
- jQuery conflict in WordPress, works fine in HTML
- How would I get this to work – send to post from thick box
- How to add drop symbol to parent nav items which have child
- WordPress 3.9 two menus in same position?
- FitVid not working for iframes on particular theme install
- Strict Standards Error bootstrap navwalker
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- WordPress custom jquery not found
- Passing a location-dependent array via wp_localize_script within a shortcode
- enqueue script if page is not equal to
- Set start page depending on screen width [closed]
- WordPress Subpages Fancybox Trouble
- How to make navigation a list without a plugin? [duplicate]
- Theme now uses require.js and enqueue script no longer works
- Fatal error: Call to undefined function the_posts_navigation()
- Bootstrap 4 mobile menu not working for WordPress Development
- jQuery Snippet Not Working on WordPress Site [closed]
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)
- WordPress Includes mejs 404 error
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- How to show children pages as array