19 September 2019

How to link css,jquery and ajax with all files via one wordpress function?

link css,jquery and ajax with all files via one wordpress function

copy this code in wordpress function.php file or main plugin file?



function ecom_scripts(){

wp_register_script( 'ecom-script', plugins_url('/js/custom.js', __FILE__), array( 'jquery' ), '', true );
    wp_localize_script( 'ecom-script', 'myajax', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
    wp_enqueue_script( 'ecom-script' );
wp_register_style( 'ecom-style', plugins_url('/css/stylesheet.css', __FILE__), true );
    wp_enqueue_style( 'ecom-style' );
}
add_action("wp_enqueue_scripts","ecom_scripts");

No comments:

Post a Comment

How to run google search console request submission by UI vision IDE automate?

 Run google search console request submission by UI vision IDE automate? Source View --- Json Code {   "Name": "DemoCsvReadAr...