composer require afragen/wp-dependency-installer
wp-dependencies.json
file.cp ./vendor/afragen/wp-dependency-installer/wp-dependencies-example.json wp-dependencies.json
wp-dependencies.json
to suit your requirements.functions.php
file.wp-dependencies.json
and it must be in the root directory of your plugin or theme.wp-dependencies-example.json
. You may use a shorthand uri such as <owner>/<repo>
in the JSON.$config
is an associative array as in identical format as json_decode( wp-dependencies.json content )
wp_dependency_timeout
to adjust this on a per project basis.wp_dependency_download_link
. The $download_link
and the $dependency
are passed as parameters.develop
branch.wp_head
function to load their scripts and stylesheets. wp_register_script()
function. This function accepts 5 parameters:wp_register_script
, we can just call the script in wp_enqueue_script()
which makes everything happen. wp_enqueue_script
, we are now using wp_enqueue_style
to add our stylesheet. wp_enqueue_scripts
action hook for both styles and scripts. Despite the name, this function works for both. plugins_url
function to point to the location of the script or style we wanted to enqueue. get_template_directory_uri()
instead. If you are working with a child theme, then use get_stylesheet_directory_uri()
.