I was using a genesis child theme so had to edit my order_tracking()
function a little. get_template_directory_uri()
gives the URL to the current child theme, combining that with the javascript filename did the trick.
Here’s what got it working:
function order_tracking() {
global $post;
if ( $post->ID == 19851 ) {
wp_enqueue_script('ordertracking', get_template_directory_uri(). "/ordertracking.js", array('jquery') ,'1.0', true );
}
}
add_action( 'wp_enqueue_scripts', 'order_tracking' );
Related Posts:
- Display current category title on category page
- WordPress Visual Editor Stripping HTML Changes
- WordPress Admin Bar pushed Sticky Footer off the bottom of the page
- Add a class to links in the visual editor (how to get old dialog back)
- How to remove hardcoded characters from playlists?
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- Calling a method from functions.php on a click of a button
- Get post meta in enqueued js file
- How to use WordPress (PHP) functions in AngularJS partials files?
- How to create a custom config file and get data using inline JS in a wordpress page
- Handling an Ajax form submit
- API JSON Data in WordPress
- StudioPress: add meta tag to every page [closed]
- How to add specific menu on a specific page or pages
- Using an Image Slider twice on the same page
- Archive dropdown styling not applied
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- Use WordPress’s Media Uploader/ Manager in non WordPress php application
- Get/Set wp.customize.previewer.previewUrl
- JQuery not working on WordPress Admin page [closed]
- How to make custom total price reactive in navigation
- Adding tawk.to code just before body tag on functions.php file
- How can I output a php value into a JS file within WordPress?
- How to test nonce with AJAX – Plugin development
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Slider loading issue
- Ajax not working es expected (Returns 0)
- Creating a Multi-Level Associative Object Using AJAX
- remove wp floating submenu in wp dashboard
- search and replace preword from author
- How to complete two other input fields, completed the first
- Status 400 for AJAX POST Request with admin-ajax.php
- Need Help Fixing My Iframes [closed]
- Incorrect MIME type for assets with Valet
- wordpress visual composer change grid builder post link
- PHP array to JS array to use in google map
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Media Upload , file name changed automatically
- Generate sidebar depending on height of post
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- How to correctly add Javascript to this PHP ‘Page Not Found’ Page?
- Error – ‘create_function is deprecated’ [closed]
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Is it save to use eval for a jQuery callback method coming from the database?
- Get html data with javascript to php array and store to wordpress database
- trouble with page_id & highlighting current page
- wordpress admin plugin menu custom css
- Load Posts on Click via Ajax into a DIV
- An audio player that showcase a random song from playlist every 24h [closed]
- How to Change CSS Colors from Custom Plugin Settings Page
- Passing the name of selected color from the custom component to `render_callback`
- After adding my website to a new server, I keep getting a unexpected end of file error, but the file is identitcal to it’s original source
- How to allow download url redirection only if user logged in WordPress site?
- Why i can’t get custom fields value or post ID via Ajax?
- wp_localize_script() and JavaScript namespaces
- Cannot access $wpdb, comes back NULL
- How to reference PHP in Javascript
- get db values for external js file
- Accessing an API with jQuery and AJAX
- Ajaxurl suddenly not defined
- WordPress – Get Posts with Category data
- How to use wp_send_json() and output the value with ajax?
- How to store checkbox data for individual users?
- html form: redirect page after form completes submit function and posts data
- Creating a brand attribute as a variable
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Add other class content with reference class value
- Gutenberg block don’t save rich text content
- Creating a POP Alert
- How do I integrate vanilla Javascript to a wordpress website?
- Hide Approved status for certain users in users list
- ACF values to Script with auto refresh
- WordPress Slider is not working
- Pulling Products from an API
- wordpress dependent dropdownlist using post type is not working
- Filtering markers on google map by WordPress category[SOLVED]
- Call jQuery function from PHP?
- How to echo a PHP code into WooCommerce variation product?
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- include javascript Multiple files in wordpress through script.js
- Ajax wordpress function showing source code in alert and not value of input field?
- I want url from a file in media using title file
- scroll scrpit to particular button position to next id when click button
- make an array in wordpress cusmization api?
- Retrieve $_POST data to send to javascript without using localize script
- Add a downloaded JS file to WordPress
- How to call javascript function (jquery) in a shortcode?
- Querying latitude and longitude into google maps correctly
- Why this plugin is not working?
- Trying to fix multiple category drop down
- js code not stored in database currectly
- Facebook share button only share the_permalink(), without thumbnail, tilte, excerpt, etc
- get_option(‘admin_email’) not working in wordpress when using ajax call
- Passing javascript variable to php file
- Javascript code not working – $ is not a function error
- Disable Typed Parameters for JavaScript in PhpStorm? [closed]
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- How can I use AJAX in child theme template?