How to enqueue an external Javascript file to Frontpage footer
Instead of init use wp_enqueue_scripts, which is used to enqueue styles and scripts in front-end. Also, for backend enqueue use admin_enqueue_scripts.
Instead of init use wp_enqueue_scripts, which is used to enqueue styles and scripts in front-end. Also, for backend enqueue use admin_enqueue_scripts.
I’m not entirely sure this is the right place for this question, but I can’t say I know of a better place. 🙂 Your rough proposal is a valid way of building said system, but I would argue that you’re losing all of the advantages of using WordPress with the stated method. By creating a … Read more
PHP get_category() function redeclared
Yup, you certainly can. At bare minimum, just require the plugin’s main file inside your plugin file. You’ll just need to activate YOUR plugin, but you’ll still have function from the included plugin. require_once ‘/otherplugin/main-file.php’; If you want to make it more sophisticated, you could set up a composer.json file in your plugin, which could … Read more
If you want to use a global variable, you have to set it outside any local scope, above your functions. For example: if (isset($_POST[‘whatever’])) { $variable = $_POST[‘whatever’]; } This will store it in the superglobal array. Now, access it using the $_GLOBALS array: function my_action(){ $whatever = $GLOBALS[‘variable’]; } I would however have an … Read more
You should keep some variable / configuration value where the plugin should know if it’s the main site or not. Your plugin should put a hook over the post publishing action, and then, communicate with each of the sites of the list. Your easy approach is to send that key as a parameter, then check … Read more
ABSPATH doesn’t work
While I can’t easily spot right now what is the cause of the bug, it is obvious that your approach is just wrong on two fronts The uploads from media library have no context, or at least it is not trivial to find out a context. An upload of font file by itself do not … Read more
I’m a total dummy. Looked through the field file and found this: function input_admin_enqueue_scripts() { // Note: This function can be removed if not used // register acf scripts wp_register_script(‘acf-input-column’, $this->settings[‘dir’] . ‘js/input.js’, array(‘acf-input’), $this->settings[‘version’]); wp_register_style(‘acf-input-column’, $this->settings[‘dir’] . ‘css/input.css’, array(‘acf-input’), $this->settings[‘version’]); // scripts wp_enqueue_script(array( ‘acf-input-column’, )); // styles wp_enqueue_style(array( ‘acf-input-column’, )); } $settings->[‘dir’] was set … Read more
I’ve used several popular plugins on my multisite without problems. The only issue I had was when I found that a plugin wasn’t working on a sub-site like I thought it should. Turns out that was my fault – the plugin wasn’t activated/enabled on that sub-site. Doh! But it all depends on how the plugin … Read more