At first I was importing stylesheets putting in the style.css of my child-theme, @import url (“css / nameofmystyle.css”), it works but…
I see all over the web that the method is wrong.
that I must use the function file.
So I created a css and js folder in my child theme.
in the css folder I put style01.css and style02.css
and in the js folder and I put style01.js and style02.js
I’m looked on the internet and tried many method I found, but I do not get called my css and js file I need for the static content of certain pages.
my function.php file is at the moment like this:
<?php
/* ----------------------------------------------------------------------------
Newspaper 6 Child theme - Please do not use this child theme with older versions of Newspaper Theme
What can be overwritten via the child theme:
- everything from /parts folder
- all the loops (loop.php loop-single-1.php) etc
- the rest of the theme has to be modified via the theme api:
https://forum.tagdiv.com/the-theme-api/
*/
/* ----------------------------------------------------------------------------
add the parent style + style.css from this folder
*/
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 1000);
function theme_enqueue_styles() {
wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.css', '', '6.1c', 'all' );
wp_enqueue_style('td-theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme'), '6.1c', 'all' );
}
Thank you in advance for your help again
I try this :
function wp_styles_reservation() {
wp_register_script('jslider', get_template_directory_uri() . '/assets/css/jslider.css');
wp_register_script('style01', get_template_directory_uri() . '/assets/css/style01.css');
wp_register_script('counter', get_template_directory_uri() . '/assets/js/counter.js');
wp_enqueue_style( 'jslider' );
wp_enqueue_style( 'style01' );
wp_enqueue_style( 'counter' );
}
add_action('wp_enqueue_scripts','wp_styles_reservation');
But it’s not working, i think my directory is wrong, but i don’t know how to resolve that.
Thanks in advance for your help
ok, i see on internet that my code is not good,
Right?
Now my code is :
function wp_styles_reservation() {
wp_register_script('jslider', get_stylesheet_directory_uri() . '/assets/css/jslider.css');
wp_register_script('style01', get_stylesheet_directory_uri() . '/assets/css/style01.css');
wp_register_script('counter', get_stylesheet_directory_uri() . '/assets/js/counter.js');
wp_enqueue_style( 'jslider' );
wp_enqueue_style( 'style01' );
wp_enqueue_style( 'counter' );
}
add_action('wp_enqueue_scripts','wp_styles_reservation');
But it still doesn’t work.
My Stylesheet not apply on the css i use on the Page i create from “WordPress Page”.
Any idea?
Thanks in advance
Ok 2 days to see my mistake
i did wrong between
wp_register_styles, wp_register_script, wp_enqueue_style and wp_enqueue_script
function wp_styles_reservation() {
wp_register_style('style01', get_stylesheet_directory_uri() . '/assets/css/style01.css');
wp_register_script('counter', get_stylesheet_directory_uri() . '/assets/js/counter.js');
wp_enqueue_style( 'style01' );
wp_enqueue_script( 'counter' );
}
add_action('wp_enqueue_scripts','wp_styles_reservation');
Now it works fine 🙂