I am new to wp, fair warning :)
I have added a new blank page by adding a php file in the twentytwenty theme folder with:
<?php
/* Template Name: charles */
?>
Then, I have created a new page by choosing the charles template in the admin.
Now In my new blank page I can see the contents of the new plugin I am creating which is what I want. So great till here.
But now, I need to add a css custom file, a js custom file and a call to the jquery cdn url. I've tried by changing twentytwenty functions.php
adding:
function wpdocs_charles_scripts() {
wp_enqueue_style( 'myStyle', get_stylesheet_uri() );
wp_enqueue_script( 'myScript', get_template_directory_uri() . '/myFiles/myScript.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_charles_scripts' );
But it does not work for my http://localhost/wordpress/charles/ Also I've tried using Simple Custom CSS and JS but this changes the styles of the whole page but not the styles in charles.
My last try in my new plugin php:
add_action('init', 'register_script');
function register_script() {
wp_register_script( 'myScript', plugins_url('/myFiles/myScript.js', __FILE__), array('jquery'), '2.5.1' );
wp_register_style( 'myStyle', plugins_url('/myFiles/myStyle.css', __FILE__), false, '1.0.0', 'all');
}
add_action('wp_enqueue_scripts', 'enqueue_style');
function enqueue_style(){
wp_enqueue_script('myScript');
wp_enqueue_style( 'myStyle' );
}
Please, help I think I am missing something basic.
Thanks a lot