Why not go to connect to a bootstrap child theme(wordpress)?

Installed woocommerce on the site, threw in a themes folder in their theme Storefront, download the starter child theme, as they recommend, here, activated it in the file functions.php added the script(saw it here), to connect bootstrap
Here is functions.php

<?php

/**
 * Storefront automatically loads the core CSS even if using a child theme as it is more efficient
 * than @importing it in the child theme style.css file.
*
 * Uncomment the line below if you'd like to disable the Storefront Core CSS.
*
 * If you don't plan to dequeue the Storefront Core CSS you can remove the subsequent line and as well
 * as the sf_child_theme_dequeue_style() function declaration.
*/
//add_action( 'wp_enqueue_scripts', 'sf_child_theme_dequeue_style', 999 );

/**
 * Storefront Dequeue the Parent theme core CSS
*/
sf_child_theme_dequeue_style function() {
 wp_dequeue_style( 'storefront-style' );
 wp_dequeue_style( 'storefront-woocommerce-style' );
}

/**
 * Note: DO NOT! alter or remove the code above this text and only add your custom PHP functions below this text.
*/

champfood_enqueue_styles function() {
 $parent_style = 'parent-style'; // style storefront
 wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css');
wp_enqueue_style(
 'child-style', 
 get_stylesheet_directory_uri() . '/style.css',
array($parent_style),
wp_get_theme()--->get('Version')
);
wp_enqueue_style(
'bootstrap',
 get_stylesheet_directory_uri() . '/assets/bootstrap/bootstrap.css');


}

add_action('wp_enqueue_script', 'champfood_enqueue_styles');


However bootstrap does not see head. The idea was to connect after
<link rel="stylesheet" id="storefront-child-style-css" href="http://champfood.mosco-web.ru/wp-content/themes/champfood/style.css?ver=4.8.2" type="text/css" media="all">

as the guy in the video.
Help to understand, surely you've done this before.

p.s. while temporarily hooked up via the cdn to begin to impose
June 14th 19 at 21:07
1 answer
June 14th 19 at 21:09
So a bootstrap where you lie? In the markup has no link to it, or just gives a 404? Do a search on the code page. If there is no tag, try to change the id of the script "bootstrap" to something else, perhaps a style with the same id is already connected to the parent theme. And at first glance everything is spelled correctly

UPD : What we're not careful)) hook called wp_enqueue_scriptS !! fix
add_action('wp_enqueue_scripts', 'champfood_enqueue_styles');
lying bootstrap /assets/bootstrap/bootstrap.css
the markup contains no link at all, and in console no errors
not in the parent theme bootstrap, I would re-connect
id of the script "bootstrap-css", wp adds the Postfix "-css" - Dianna.Harris commented on June 14th 19 at 21:12

lying bootstrap /assets/bootstrap/bootstrap.css

in what subject?

not in the parent theme bootstrap, I would re-connect

bootstrap means "initial download". It's not necessarily a css framework. Still try to change idшник style - aaron commented on June 14th 19 at 21:15
damn man, what are you stupid, no offense.
connect the bootstrap of the child theme, exactly after connecting the child style.css. This is evident from the script that I threw - Dianna.Harris commented on June 14th 19 at 21:18
I can see it.
And I will write again - to change aydishnik style 'bootstrap' to any gibberish. and see whether the result. Try to connect any other style and see what happens.

You can leave your code unchanged and wait for someone foretold response to the position of the planets. But problems are not solved. And you can try to change something and watch what happens.
In any case, if you write: "here is my code, here it's all written, I will not change anything", then how can I help you?

connect the bootstrap of the child theme


I see that you connect it from the child theme, but I asked you what the topic it is on the disk, however it does not matter. - aaron commented on June 14th 19 at 21:21
And even a little bit not clear why it is making the connection, and the parent style and the child. If the child style.css just replace the parent and you do not need to connect via functions.php. But if you need styles of a parent, then you can just add the import in child css. ie champfood_enqueue_styles() you can leave only the connection of additional styles and scripts. I also recommend to add a priority hook
add_action('wp_enqueue_script', 'champfood_enqueue_styles');
that he would run AFTER the parent theme functions
add_action('wp_enqueue_script', 'champfood_enqueue_styles', 50);
. In General, you can also try, these are examples of my live sites - aaron commented on June 14th 19 at 21:24
there in the script first

Storefront automatically loads the core CSS even if using a child theme as it is more efficient
than @importing it in the child theme style.css file.


changed id to "bootstrapPleaseWork" but he had not heard my prayers :(

it is interesting that everything is connected correctly and correct order. The only thing bootstrap does not appear - Dianna.Harris commented on June 14th 19 at 21:27
basically, he can look http://champfood.mosco-web.ru, first connects to the storefront.css then champfood.css and bootstrap then I expect.css(which is not) - Dianna.Harris commented on June 14th 19 at 21:30
listen , that's weird.. try this atk still
champfood_enqueue_styles function() {
 wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/assets/bootstrap/bootstrap.css');
//add some more styles and scripts any. just create a few empty files and plug
}

add_action('wp_enqueue_script', 'champfood_enqueue_styles', 20);
- aaron commented on June 14th 19 at 21:33
alas , but no : (
some kind of tin : ( - Dianna.Harris commented on June 14th 19 at 21:36
that is generally no assets are unable to connect? do I understand correctly? not only bootsrap?
For example,
wp_enqueue_style( 'carousel', get_stylesheet_directory_uri() . '/assets/carousel.css');
?
PS by the Way, cdn'using ku just as well using wp_enqueue_style() to connect. only instead of the path, pass in the arguments the url to the style, but it is. - aaron commented on June 14th 19 at 21:39
I am on a LAN will deploy the Storefront from WP and your child theme.. I was already interested - aaron commented on June 14th 19 at 21:42
added

wp_enqueue_style(
'hamburger',
 get_stylesheet_directory_uri() . '/assets/hamburger.css'
);


does not show, campaign /assets/ nothing ; ( - Dianna.Harris commented on June 14th 19 at 21:45
corrected the answer - aaron commented on June 14th 19 at 21:48
corrected the name of the hook without any changes. I even added a block with id="page" class "hoooorayyy" to see if changes anything. And Yes, the class added! But the styles of assets - no. - Dianna.Harris commented on June 14th 19 at 21:51
, it can not be something I do wrong. here I am doing the same
<?php

/**
 * Storefront automatically loads the core CSS even if using a child theme as it is more efficient
 * than @importing it in the child theme style.css file.
*
 * Uncomment the line below if you'd like to disable the Storefront Core CSS.
*
 * If you don't plan to dequeue the Storefront Core CSS you can remove the subsequent line and as well
 * as the sf_child_theme_dequeue_style() function declaration.
*/
//add_action( 'wp_enqueue_scripts', 'sf_child_theme_dequeue_style', 999 );

/**
 * Storefront Dequeue the Parent theme core CSS
*/
sf_child_theme_dequeue_style function() {
 wp_dequeue_style( 'storefront-style' );
 wp_dequeue_style( 'storefront-woocommerce-style' );
}

/**
 * Note: DO NOT! alter or remove the code above this text and only add your custom PHP functions below this text.
*/

add_action('wp_enqueue_scripts', 'my_enqueue_styles');
my_enqueue_styles function() {
 wp_register_style('my-style', get_stylesheet_directory_uri() . '/my-style.css');
wp_enqueue_style('my-style');
}</property-->
br><br> Screenshot <a href="http://prntscr.com/grx6tv" rel="nofollow" target="_blank">prntscr.com/grx6tv</a> - aaron commented on June 14th 19 at 21:54
damn dude, you got it all worked like clockwork : ( - Dianna.Harris commented on June 14th 19 at 21:57
make sure that the file with the functions filled on the server. Look at it from the admin panel of WP. The code should work. - aaron commented on June 14th 19 at 22:00
I, again, from the admin panel and edit it) using wp-editor - Dianna.Harris commented on June 14th 19 at 22:03
okay. stupidly copy my code and replace in your file.. and see what happens.. If everything is OK, you get a 404 in the console for my-style.css - aaron commented on June 14th 19 at 22:06
error crashes : ( - Dianna.Harris commented on June 14th 19 at 22:09

Find more questions by tags Web DevelopmentPHPFrontendWordPress