简体   繁体   中英

CSS File in subforlder of theme not working wordpress?

I asked this after searching lots but any tricks and answer not working. i am new and created own custom theme. i upload custom font awesome in my theme directory as follow

  • -Gohilar-font
  • --CSS
  • ---gohilar-font-embedded.css
  • --font
  • ---gohilar-font.woff

now the problem is when i link this css file into my header.php it not linking even i tried all suggestion in many site........however it work correctly in my local computer ie localhost

i added code of css in header.php as follows under head

  <link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/gohilar-font/css/gohilar-font-embedded.css">

if i link http://newser.in/wp-content/themes/Gohilar/gohilar-font/css/gohilar-font-embedded.css not opening currectly and shows 404 error

The recommended way to include css files is to make use of the wp_enqueue_style. Just add the following code to your function.php and adjust the file name and path.

// load bootstrap css
wp_enqueue_style( '_tk-bootstrap', get_template_directory_uri() . '/includes/resources/bootstrap/css/bootstrap.min.css' );

Source: https://developer.wordpress.org/reference/functions/wp_enqueue_style/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM