admin管理员组

文章数量:1415476

I import the same styles and scripts in the plugin and they don't work fully. The same styles and scripts if I import in the template it works great.

this is the code to import

add_filter( 'template_include', 'if_is_simulator', 1000 );

function if_is_simulator( $template ){

    if(is_page_template('tempalte-simulotors.php')){



    add_action( 'wp_enqueue_scripts', 'simulator_incloud' );

    }
    return $template;

}


function simulator_incloud() { 

wp_enqueue_style(
    'bootstrap-css',
    SIMULATOR_URI.'css/bootstrap/bootstrap-4.0.0.css',
    array(),
    '4.3.1',
    'all');
wp_enqueue_style(
    'bootstrap-css-rtl',
    '.2.1/css/bootstrap.min.css',
    array(),
    '4.3.1',
    'all');


wp_enqueue_script(
    'bootstrap-js',
    '.2.1/js/bootstrap.min.js',
    array('jquery'),
    '4.3.1',
    true);

wp_enqueue_script(
    'fontawesome-js',
    '.js',
    array(),
    '4.3.1',
    true);

wp_enqueue_script(
    'popper-js',
    '.js/1.14.7/umd/popper.min.js',
    array('jquery'),
    '4.3.1',
    false);

wp_enqueue_script(
    'my-js',
    SIMULATOR_URI .'js/script.js',
    array('jquery'),
    '4.3.1',
    true);

wp_enqueue_style(
    'simulator-style',
    SIMULATOR_URI . 'css/rtl.css',
    [
        'simulator'
    ],
    '1.0.0'

);
wp_enqueue_script( 'ajax_import_rows' );
}

本文标签: phpImporting the style and scripts in the plugin doesn39t work as well as in the theme