Just drop it in a plugin. Theme = view. Plugin = constructor. I keep most of my stuff in plugins. IMHO only stuff that belongs to the visual part should be in the Theme. And yes, you can do a simple require( plugin_dir_path( $file_name ) );
for subfiles.
Related Posts:
- Cross-Origin Read Blocking (CORB)
- syntax error: unexpected token <
- Infinite Scrolling in Asp.Net MVC with jQuery / AJAX Issues
- ajax jquery simple get request
- jQuery get textarea text
- Response to preflight request doesn’t pass access control check
- jQuery AJAX cross domain
- Send POST data using XMLHttpRequest
- Set timeout for ajax (jQuery)
- How to generate a simple popup using jQuery
- What does on() in JavaScript do?
- jQuery AJAX submit form
- jQuery Ajax File Upload
- How can I upload files asynchronously with jQuery?
- Adding images to a Bootstrap Carousel with AJAX
- AJAX response error: net::ERR_EMPTY_RESPONSE
- Disable same origin policy in Chrome
- Access Control Request Headers, is added to header in AJAX request with jQuery
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- XMLHttpRequest status 0 (responseText is empty)
- Basic Ajax send/receive with node.js
- Execute PHP function with onclick
- Uncaught TypeError: Cannot read property ‘appendChild’ of null
- JSON.parse() not working
- jQuery Ajax POST example with PHP
- Refresh/reload the content in Div using jquery/ajax
- How does AJAX work?
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Scroll to bottom of div?
- How to manage a redirect request after a jQuery Ajax call
- How to allow CORS in react.js?
- FormData append not working
- Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
- Download a file by jQuery.Ajax
- What is ‘xmlhttp.setRequestHeader();’ and in which situations is it used?
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- Ajax success function
- JAX post error : Refused to set unsafe header “Connection”
- AngularJS POST Fails: Response for preflight has invalid HTTP status code 404
- $http.get(…).success is not a function
- Does wp_localize_script call a Javascript Function or Simply Pass PHP Parameters to It
- How to make wordpress URLS google friendly for ajax driven sites?
- AJAX not Working with php as supposed
- How can I generate a rainbow circle using HTML5 canvas?
- What’s the difference between “{}” and “[]” while declaring a JavaScript array?
- What does “javascript:void(0)” mean?
- For-each over an array in JavaScript
- How to delete a cookie?
- What is TypeScript and why would I use it in place of JavaScript? [closed]
- How do you use the ? : (conditional) operator in JavaScript?
- Which equals operator (== vs ===) should be used in JavaScript comparisons?
- are there dictionaries in javascript like python?
- How to do associative array/hashing in JavaScript
- How to make a discord bot create an invite for every server it joins?
- ES6 Map in Typescript
- addEventListener vs onclick
- “Uncaught SyntaxError: Cannot use import statement outside a module” when importing ECMAScript 6
- How do I check if an array includes a value in JavaScript?
- JavaScript document.getElementById().value logs empty value
- How do I color a hexagonal grid such that it doesn’t have neighbors of the same color?
- How to format a JavaScript date
- What does href expression do?
- map function for objects (instead of arrays)
- Wait 5 seconds before executing next line
- Failed to load resource: the server responded with a status of 404 (Not Found)
- How to check whether a string contains a substring in JavaScript?
- Check if a string has a certain piece of text [duplicate]
- Kadane’s algorithm explained
- What is console.log?
- Dynamically creating charts of each row in an HTML table with chart.js
- Failed to load resource: the server responded with a status of 404 (Not Found)
- How to convert a string to an integer in JavaScript?
- Maximum call stack size exceeded error
- How to change CSS using jQuery?
- How to properly use jsPDF library
- Cross-Origin Read Blocking (CORB)
- How to reload a page using JavaScript
- How can I do string interpolation in JavaScript?
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- Start script missing error when running npm start
- How do I redirect to another webpage?
- How to round to at most 2 decimal places, if necessary?
- What is VanillaJS?
- Invariant Violation: Objects are not valid as a React child
- How do I make the first letter of a string uppercase in JavaScript?
- How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()
- window.location.href and window.open () methods in JavaScript
- Invariant Violation: Objects are not valid as a React child
- What’s the difference between using “let” and “var”?
- Angular: conditional class with *ngClass
- How do I make the first letter of a string uppercase in JavaScript?
- Loop through an array in JavaScript
- How to format a JavaScript date
- What does this symbol () => mean in Javascript? [duplicate]
- How do I redirect to another webpage?
- Google reCAPTCHA V3.0 not working. “ERROR for site owner: Invalid key type”
- How to round to at most 2 decimal places, if necessary?
- Google Chrome Uncaught (in promise) DOMException while playing AUDIO
- Define a global variable in a JavaScript function
- “SyntaxError: Unexpected token < in JSON at position 0"