filemtime(): stat failed warning within a child theme

The problem is in your parent theme. The parent theme is using get_stylesheet_directory() here: filemtime(get_stylesheet_directory() . ‘/dist/css/custom-style.css’), When the parent theme is active, that’s fine, because get_stylesheet_directory() will point that file in the parent theme. The problem is that when you activate a child theme, it is trying to get the filemtime() of ‘/dist/css/custom-style.css’ in … Read more

Which is the correct way to conditionally enqueue a CSS file?

I agreed with @PatJ — you should check if get_queried_object() returns an object or not. But you could simplify your code by simply using is_category() and in_category() which are conditional tags in WordPress: if ( is_category( 3 ) || in_category( ‘arta’ ) ) { wp_enqueue_style( ‘twentytwenty-style-2’, get_stylesheet_directory_uri() . ‘/style-arta.css’, array(), $theme_version ); }

How to change menu labels

In order to change the menu labels you will have to go to add this code into your functions.php: add_filter( ‘gettext’, ‘change_woocommerce_text’ ); function change_woocommerce_text( $translated ) { $translated = str_replace( ‘WooCommerce’, ‘Store’, $translated ); return $translated; } Tested.

Load CSS in footer, like your can with JS?

Yes, technically you can. But you shouldn’t load css in the footer, css links outside of the <head> are considered invalid. A better technique would be to add the css-links to the dom with javaScript. You may even want to split out the css so that critical portions are loaded inline (so you avoid a … Read more

responsive.css in the WordPress should be prioritized

If you want to make sure the second stylesheet loads after the first, you can use the third argument of wp_enqueue_style to set a dependency, eg: wp_enqueue_style( ‘styles’, THEMEROOT . ‘/css/style.css’, array() ); wp_enqueue_style( ‘responsive’, THEMEROOT . ‘/css/responsive.css’, array(‘styles’) ); As for having all the styles in responsive.css override style.css, that is going to entirely … Read more

Font Awesome changing default WordPress Font

It was not Font-Awesome that changed the default WordPress Style. I also use Bootstrap. One file called scaffolding.less overrides the WordPress defaults with: // Body reset html { font-size: 10px; -webkit-tap-highlight-color: rgba(0,0,0,0); } body { font-family: @font-family-base; font-size: @font-size-base; line-height: @line-height-base; color: @text-color; background-color: @body-bg; } I just added this to my custom CSS File … Read more

CSS not affecting widget output

The problem was due to an incorrect file path in the movieposterdisplay-scripts file. Whilst the file loaded correctly in the main php file require_once(plugin_dir_path(__FILE__).’/includes/movieposterdisplay- class.php’); as it already assigned the correct plugin folder name. It did not enqueue correctly as the code was wp_enqueue_style(‘mpd-main-style’, plugins_url().’/movieposterdisplay/css/style.css’); and I had previously changed the folder name. Hence I … Read more

How do I make header.php use different css for different pages?

Create a primary stylesheet and enqueue as normal. Then, make a series of conditional statements using WP core functions – is_home(), is_404(), is_page_template(‘template.php’) and so on. In each of those conditionals, enqueue the stylesheet you want that overwrites your core stylesheet, using your primary (style.css) stylesheet as a dependency. Untested code, but should work: function … Read more

Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]

Not sure if that’s what you need, but take a look. // Can be put into function.php if ( !is_admin() ) { add_action( “wp_enqueue_scripts”, “enqueue_scripts”, 11 ); } function enqueue_scripts() { // Theme CSS (style.css) wp_enqueue_style( ‘style-file’, get_template_directory_uri() . ‘/style.css’,false,’1.0′,’all’ ); // JS wp_register_script( ‘script’, get_template_directory_uri() . ‘/your-script.js’, array(‘jquery’) ); wp_enqueue_script( ‘script’ ); } Or … Read more