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)?
- How to replace Avatar link in profile page with upload profile pic. button using media library and display it in profile page and all wordpress site
- Is there a way to enable horizontal margin for a specific block element?
- How to change background color in the Notepad++ text editor?
- How to change or add theme to Android Studio?
- WordPress frameworks and parent themes [closed]
- Opinions and recommendations on the best barebones base theme [closed]
- Remove JSON API links in header html
- Using OOP in themes
- Where can I download WordPress themes from? [closed]
- How can I allow the Editor Role to change Theme Settings?
- What are all the available parameters for query_posts?
- Customizing a WordPress theme without changing it?
- Where can I learn to create my own theme?
- How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?
- how to add version of style.css in wordpress
- Does WordPress work without a theme?
- What is the role and history of the $content_width global variable?
- theme path in javascript file
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How to move the sidebar in TwentyFifteen to the right?
- How to Link External jQuery/Javascript files with WordPress
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- Override parent theme translation on child theme
- WordPress Theme activation hook?
- Can wordpress theme folder name be changed freely and nothing technically happens
- Link to specific Customizer section
- What does exactly GPL license mean for my WordPress theme?
- Am I allowed to license my WordPress theme under the aGPL
- WordPress API Menu/Submenu Order
- How do I change the header image height in Twenty Seventeen?
- Starter Theme vs Parent Theme? Pros and cons
- How to change the language for the front-end only?
- W3 Total Cache, CDN and theme files [closed]
- Best way to include Bootstrap in WordPress
- How to set thumbnail image for a (child) theme
- Different template of products for specific category. WooCommerce
- Show different theme for admin?
- How can I version the main CSS file?
- what the best way to include images from the template’s images folder?
- Is it OK to remove theme credits from footer? [duplicate]