Search
 
SCRIPT & CODE EXAMPLE
 

PHP

enqueue wordpress

function wpdocs_theme_name_scripts() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri() ); /* enqueues style.css */
    /* if you want to enqueue other styles use: */
    /* wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/your-style-name.css' ); */
    wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
Comment

wordpress enqueue scripts and styles

/**
 * Proper way to enqueue scripts and styles
 */
function wpdocs_theme_name_scripts() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri() );
    wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
Comment

how to add js to wordpress with wp_enqueue_scripts

function ti_custom_javascript() {
wp_enqueue_script( 'example-script', get_template_directory_uri() . '/js/examplescript.js');
}
add_action('wp_enqueue_scripts', 'ti_custom_javascript');
Comment

wordpress enqueue jquery

add_action('wp_enqueue_scripts', 'my_register_script_method');

function my_register_script_method () {
    wp_register_script( 'jqueryexample', 'https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js');
}
Comment

enqueue wordpress

function my_scripts_method() {
    wp_enqueue_script(
        'custom-script',
        get_stylesheet_directory_uri() . '/js/custom_script.js',
        array( 'jquery' )
    );
}

add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
Comment

wordpress enqueue js

add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );
function my_plugin_assets() {
    wp_enqueue_style( 'custom-gallery', plugins_url( '/css/gallery.css' , __FILE__ ) );
    wp_enqueue_script( 'custom-gallery', plugins_url( '/js/gallery.js' , __FILE__ ) );
}
Comment

wordpress enqueue script on page

function my_enqueue_stuff() {
  if ( is_page( 'landing-page-template-one' ) ) {
    /** Call landing-page-template-one enqueue */
  } else {
    /** Call regular enqueue */
  }
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_stuff' );
Comment

enqueuing javascript in wordpress

function mysofthunt_enqueue() {
    wp_enqueue_script(
        'softhunt-script',
        plugins_url( 'softhunt.js', __FILE__ )
    );
}
add_action( 'enqueue_block_editor_assets', 'mysofthunt_enqueue' );
Comment

PREVIOUS NEXT
Code Example
Php :: phpexcel set row height 
Php :: php stop loading page 
Php :: php How to add custom button in wordpress admin section 
Php :: get specific word from string php 
Php :: how to make a json request in php 
Php :: php all date arguments 
Php :: Codeigniter 3 Get future date recocords - upcoming records from database 
Php :: pdo connection 
Php :: define php 
Php :: get request header codeingiter3 
Php :: laravel model 
Php :: ?? php 
Php :: echo errors php 
Php :: tinker faker 
Php :: laravel vue browser cache auto clear 
Php :: how run job laravel in cpanel host 
Php :: how check the checkbox is check php 
Php :: display error meaages in laravel blade 
Php :: laravel select where with total sum query to get all data with sum 
Php :: faker instance in tinker 
Php :: php variable as javascript function parameter in echo 
Php :: strrev php 
Php :: what is array_map in php 
Php :: laravel seeder 
Php :: php apns notification source code 
Php :: how to pass data to controller in laravel 
Php :: python to php converter online 
Php :: preg_split in php 
Php :: laravel-enum 
Php :: magento 1.9 get all product 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =