Why is style.css not loading through the functions.php
The URL returned by get_stylesheet_directory_uri() does not have a slash, so you need to add one .E.g.: wp_enqueue_style( ‘style’, THEMEROOT . ‘/style.css’ );
The URL returned by get_stylesheet_directory_uri() does not have a slash, so you need to add one .E.g.: wp_enqueue_style( ‘style’, THEMEROOT . ‘/style.css’ );
It works for me. Please try it out.Thanks function tf_add_google_fonts() {wp_enqueue_style( ‘tf-google-fonts’, ‘http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300’, false ); } add_action( ‘wp_enqueue_scripts’, ‘tf_add_google_fonts’ );
Try using parent and child class to use css on specific page <div class=”top-container”><span class=”header-text”> content here</span> </div> Assign a page level class .top-container{} And then assign use it as a parent class for styling rest of elements on page .top-container .header-text{} You do not need to load a separate stylesheet rather than you can … Read more
/css/media.min.css?ver=4.8.1 is not indicative of a “min version”. The filename of this CSS file is LITERALLY: ‘media.min.css’. (Additionally the file is versioned with the ver parameter set to 4.8.1). So atetmpting to enqueue: wp_enqueue_style(‘media’, get_template_directory_uri().’/css/media.css’); Will certainly fail, and should in fact be: wp_enqueue_style(‘media’, get_template_directory_uri().’/css/media.min.css’);
You are using a child theme here, it means that you should use get_stylesheet_directory_uri() to get the child theme’s directory. So, in your case, get_stylesheet_directory_uri() will return: localhost:8888/wp-content/themes/x-child/ and get_template_directory_uri() will return: localhost:8888/wp-content/themes/x/ Use this to build your paths. Also, pay attention that you need to include a forward slash before your style/script’s name, since … Read more
Using wp_enqueue_scripts You should use a proper hook to enqueue/dequeue your scripts, to ensure that it works flawlessly. A proper plugin/theme uses wp_enqueue_scripts to do this, so you should do the same. Wrap your code inside a function, and bind it to this action hook. Also, remember to set the priority to something that makes … Read more
i can’t handle any style or Js file on my theme . what is the problem of this file?
The get_template_directory_uri() function returns the URL to the root theme. If a child theme is used and you want to return the URL to the current child theme, use get_stylesheet_directory_uri() instead. https://developer.wordpress.org/reference/functions/get_stylesheet_directory_uri/
I found the error. It is the inspect tool of Google Chrome that is broken. When viewing the device toolbar and checking on different screen size it doesn’t work. It only works when you manually resize the window without the device toolbar activated.
Two things you need to: Hook into wp_enqueue_scripts with a priority later than the parent theme’s. The default is 10 so that’s a good assumption. If 11 doesn’t work, check the parent theme’s source to see which priority it’s hooked at. Use wp_dequeue_style() to do the dequeueing. That will look like: function wpse_293836_dequeue_parent_styles(){ wp_dequeue_style( ‘theme-skin-color’ … Read more