The problem is not there in your @font-face it’s actually in the functions.php
where you enqueued the stylesheets.
What I assume your parent theme is enqueuing stylesheets like below:
<link rel="stylesheet" id='bootstrap-css' href="http://example.com/wp-content/themes/parenttheme/bootstrap.min.css" type="text/css" media="all" />
<link rel="stylesheet" id='style-css' href="http://example.com/wp-content/themes/parenttheme/style.css" type="text/css" media="all" />
But what’s happening in your child theme:
<link rel="stylesheet" id='parent-style-css' href="http://example.com/wp-content/themes/parenttheme/style.css" type="text/css" media="all" />
<link rel="stylesheet" id='child-style-css' href="http://example.com/wp-content/themes/childtheme/style.css" type="text/css" media="all" />
<link rel="stylesheet" id='bootstrap-css' href="http://example.com/wp-content/themes/parenttheme/bootstrap.min.css" type="text/css" media="all" />
Because Child theme’s code is getting priority.
So you would need something like below – a correct stylesheet-dependency-order (as mentioned here with $deps
):
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array('bootstrap') );
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style' ) );
Note, the array('bootstrap')
declaration on parent style will load the parent style after bootstrap, and array( 'parent-style' )
declaration on child style will load the child style after parent style.
<link rel="stylesheet" id='bootstrap-css' href="http://example.com/wp-content/themes/parenttheme/bootstrap.min.css" type="text/css" media="all" />
<link rel="stylesheet" id='parent-style-css' href="http://example.com/wp-content/themes/parenttheme/style.css" type="text/css" media="all" />
<link rel="stylesheet" id='child-style-css' href="http://example.com/wp-content/themes/childtheme/style.css" type="text/css" media="all" />
Follow the correct dependency accordingly if you have more other CSS files in your parent theme.