Skip to content

Instantly share code, notes, and snippets.

@uptimizt uptimizt/php
Last active Mar 21, 2016

Embed
What would you like to do?
добавляем скрипт в тему и плагин
//пример для плагина
function add_script_in_plugin_1(){
wp_enqueue_script('custom-script', plugins_url( '/js/newscript.js', __FILE__ ), array('jquery'));
wp_enqueue_style( 'style-name', plugins_url( '/css/custom.css', __FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'add_script_in_plugin_1' );
//add_action( 'admin_enqueue_scripts', 'add_script_in_plugin_1' );
//add_action( 'login_enqueue_scripts', 'add_script_in_plugin_1' );
//пример для темы
function add_script_in_theme_1(){
wp_enqueue_script( 'name_new_script', get_template_directory_uri() . '/js/custom_script.js');
wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/custom.css' );
}
add_action( 'wp_enqueue_scripts', 'add_script_in_theme_1' );
//add_action( 'admin_enqueue_scripts', 'add_script_in_theme_1' );
//add_action( 'login_enqueue_scripts', 'add_script_in_theme_1' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.