To print JavaScript code to your page, you have several paths to choose from. The most obvious would be the wp_footer
action. Just hook a function to it and make it print your JavaScript/jQuery code, wrapped in <script />
tags.
// EDIT
As an addition, if your custom JavaScript/jquery code is static (i.e., there are no dynamic parts in it), you should put it in a separate JS file and enqueue it with the lib as dependency. But you explicitly asked for printing so that’s what I answered.
As for your comment, as long as your code doesn’t have to be executed before the page has been rendered—which doesn’t seem to be the case, according to your question (document.ready
)—this is just best practice to enqueue script files in the footer.
Related Posts:
- Best practices for a Style/CSS based theme options page?
- How to use media upload on theme option page?
- Add a page outside of the current theme?
- Jquery in Child Theme
- Want to have the Post editor remembering the last editing position
- Switch Theme Through Options Panel
- When does WordPress wrap inline scripts in CDATA?
- How to make alert for new version on theme options?
- How to mark an option as selected
- How can I show more than 15 themes at a time in the admin menu?
- How to go about pre generating css file with variables from theme options
- Question about the way that wp_register_script works
- Does uninstalling a WordPress theme delete its database values?
- Cannot find the code for “Edit This” link in posts in a specific theme
- Defining different theme for Blog posts page
- How to set different settings for a mobile theme?
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- Disable Theme API / Front end (for API only environment)
- Add js into a theme [closed]
- How to understand a specific bit of WordPress syntax
- Should a child theme share the same theme options row as the parent, or should it have it’s own options row?
- Creating a theme options page
- Retina JS not working
- How Do I Use A Custom Mobile Theme?
- How can I make some themes usable only by admins?
- Custom options below pages/posts editor?
- JavaScript Files Registered in Parent Theme Won’t Load When Calling wp_enqueue_script() in Child Theme?
- Angular integration with homepage
- Twenty fifteen theme – change responsive menu condition
- Redux callback action
- Preserve theme settings when migrating from local to live
- how do i in ignore/disable/delete a javascript call from parent in child theme?
- Functions containing parameter ‘yourtheme’
- What is the “pub” theme? [closed]
- Passing dynamic options from backend to frontend
- Color Options from Theme Customizer API not returning via get_theme_mod()
- Using JQuery to check for Rel Attribute of Image before Overriding It
- Getting a ‘slide down’ js panel implemented within WP
- Issue with theme mod options during domain migration
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- .PO file is found but I don’t see translations: how to debug the problem?
- How to add some php code in header.php using plugin
- WordPress activate theme error $pagenow
- How to use only scripts from new theme?
- Setting a new default template for the creation of a page
- Cannot update a file for my theme
- List of categories instead of dropdown menu selector in admin options
- Switching among theme customizations
- Webflow Interactions on WordPress site?
- share wrordpress data between two shared hosts using REST API
- how to create a section inside a section with theme options customizer
- Warning: call_user_func() expects parameter 1 to be a valid callback
- Will this js code work in a page template?
- Create /archive page in WordPress Theme
- JQuery Error in theme for .live is not a function [closed]
- Church hope them issue
- Divi theme including javascript
- Help!!! Old theme doesn’t load scripts and conflitcs with plugins
- How to remove pop up on website (css changes not visible)?
- “Unexpected error” on update requests
- How to prevent plugin, theme installation failures on WordPress?
- Error message “The page you are looking for is temporarily unavailable.” after editing a file [closed]
- A hook that runs only when the theme is previewed
- WordPress theme with multiple color schemes
- When can changing a theme damage a website?
- X-Axis of Site is Messed Up Because it is in Hebrew
- How to create my own sidebar in Twenty Eleven child theme?
- style.css not reflecting changes. I have no cache installed
- Permissions for installing themes and files in general?
- Twenty Seventeen search error
- Protect shortcodes, custom JS, and CSS from theme updates
- Free WordPress theme for an intranet tutorial site [closed]
- How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)
- Why are so many popular responsive WordPress themes “boxed” at 940px? [closed]
- Theme Modified By Updates
- I want to develop a theme using WordPress. Which theme should I start from or develop from scratch? [closed]
- Background image appears on localhost site but not online
- Load CSS files in header of Bones theme?
- Pages and posts on ElegantTheme featured slider [closed]
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Child theme breaks after update of master theme
- Insert the current theme header into an external HTML/XHTML file
- How to use one git (github) repository for version control for multiple themes
- Is there any way to modify images from a theme using the web interface?
- on change form submit variable value not updating
- Ajax Call not Working in Plugin
- Conditional Banners
- sidebar in 2020 theme as a widget
- Tinymce button is not visible for a theme
- Serve resources from a consistent URL GT Metrix
- Meta title W3C Validation Error with
- Two types of layout in woocommerce SHOP page [closed]
- How to include a new file in theme
- How to have a WordPress user profile just having one button and one input textbox?
- File execution order
- How to show associated fields if checkbox is checked in customize widget screen using wp_customize?
- How to add color icons to front of custom block color palettes
- TItle In Latest Post is not using H1 Tag [closed]
- Custom Theme Additonal CSS “” are transformed to “>” and “<”
- How do I fix this “Uncaught ReferenceError: woodmartThemeModule is not defined”?