Snippets Collections
if ( ! defined( 'WPINC' ) ) {
	die;
}

add_action( 'wp_enqueue_scripts', 'custom_enqueue_files' );
/**
 * Loads <list assets here>.
 */
function custom_enqueue_files() {
	// if this is not the front page, abort.
	// if ( ! is_front_page() ) {
	// 	return;
	// }

	// loads a CSS file in the head.
	// wp_enqueue_style( 'highlightjs-css', plugin_dir_url( __FILE__ ) . 'assets/css/style.css' );

	/**
	 * loads JS files in the footer.
	 */
	// wp_enqueue_script( 'highlightjs', plugin_dir_url( __FILE__ ) . 'assets/js/highlight.pack.js', '', '9.9.0', true );

	// wp_enqueue_script( 'highlightjs-init', plugin_dir_url( __FILE__ ) . 'assets/js/highlight-init.js', '', '1.0.0', true );
}
jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function
    [ your code goes here ]
} );
//set up load.php inside /wp-content/mu-plugins, then add:
require(WPMU_PLUGIN_DIR . '/myplugin/myplugin.php');

//OR –– use below for multiple mu-plugins inside a subdirectory
//
// Opens the must-use plugins directory
$wpmu_plugin_dir = opendir(WPMU_PLUGIN_DIR);

// Lists all the entries in this directory
while (false !== ($entry = readdir($wpmu_plugin_dir))) {
$path = WPMU_PLUGIN_DIR . '/' . $entry;

// Is the current entry a subdirectory?
if ($entry != '.' && $entry != '..' && is_dir($path)) {
// Includes the corresponding plugin
require($path . '/' . $entry . '.php');
}
}

// Closes the directory
closedir($wpmu_plugin_dir);
star

Mon Oct 25 2021 06:55:32 GMT+0000 (UTC) https://github.com/srikat/my-custom-functionality/blob/master/plugin.php

#wordpress #mu-plugins #php
star

Mon Oct 25 2021 06:48:12 GMT+0000 (UTC) https://developer.wordpress.org/reference/functions/wp_enqueue_script/

#wordpress #mu-plugins #jquery
star

Mon Oct 25 2021 06:36:11 GMT+0000 (UTC) https://www.sitepoint.com/wordpress-mu-plugins/

#wordpress #php #mu-plugins

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension