Questions tagged [wp-enqueue-style]

A safe way to add/enqueue a CSS style file to the wordpress generated page. If it was first registered with wp_register_style() it can now be added using its handle.

Filter by
Sorted by
Tagged with
0
votes
1answer
107 views

Is this the correct way to enqueue style sheets from parent theme and then from child theme in wordpress?

I am creating a child theme of a theme in WordPress. In Parent theme i have style.css and inside css folder of parent theme i have a base.css file ( and some more css files but the problem is only ...
0
votes
2answers
2k views

How to make child theme in wordpress with wp_enqueue_style ? Using Enough Theme

I am using Enough theme and i want to create a child theme the way suggested in codex i.e. using wp_enqueue_style. I am doing it the way it's explained but left margin more now like it's indented to ...
0
votes
1answer
419 views

How would one set or override a Fallback font for characters in second language?

In my website, posts occasionally contain characters from a second language (Urdu), which the google web-font set by my theme, of course does not recognize and resorts to a fallback font. I was ...
3
votes
1answer
347 views

What determines the order of enqueued styles?

Typically when I add stylesheets I use wp_enqueue_style multiple times within a single function, then call that function once with wp_enqueue_scripts. There doesn't seem to be any logic to the order ...
2
votes
2answers
299 views

Can't make wp_enqueue work

I have this weird problem. Trying to enqueue a CSS file on an existing functions.php file and nothing seems to work. This is the pertinent part of the functions file, made by someone else based on ...
2
votes
1answer
2k views

The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme

I am new to WordPress. I have started creating my own custom theme. When I am creating it, I have found that add_action('wp_enqueue_script', 'custom_script'); can be used to add styles as well. Can ...
0
votes
2answers
783 views

javascript and css not loading properly in WordPress site

I managed to make my code working via codepen as you can see if you visit the link here Now trying to implement on a WordPress test site it looks like my javascript is not working as well as the ...
0
votes
2answers
535 views

Add inline style to pages where shortcode was used

I am trying to add a style to the header, using this method the style only loads on single posts but if I use a shortcode to load the post content that style does not load in the header: add_action( ...
3
votes
2answers
1k views

How to add a style to taxonomy edit page

Is there anyway to load a custom style in specific taxonomy pages? for example these two pages: wp-admin/edit-tags.php?taxonomy=news-category&post_type=news wp-admin/term.php?taxonomy=news-...
2
votes
1answer
282 views

Dequeue only stylesheets but not inline style added using wp_add_inline_style

I have this two line below on my parent theme: wp_enqueue_style('theme-dynamic-styles', get_template_directory_uri() . '/custom.css'); wp_add_inline_style('theme-dynamic-styles', $output); ...
1
vote
2answers
77 views

My style in my child theme loads after the parent theme, but it breaks stuff: How do I load it before the parent theme?

I'm building my child theme, but including materialize css that I want to use, breaks the entire site when enqueued in functions.php. How do I change that? function bla_enqueue_child_theme_styles() { ...
1
vote
3answers
432 views

Child theme style repeated

I have create child theme with style.css and functions.css, I edit parts style.css in child theme to get best style. But some page have no effect and style.css from child theme repeated with another ...
3
votes
3answers
2k views

How to add the main style.css to my index.php?

I'm creating for the first time a theme from scratch. It's not a child theme In theme's function.php file I'm doing add_action( 'wp_enqueue_scripts', function() { wp_enqueue_style( 'style', ...
1
vote
1answer
73 views

Can't catch enqueued style

I'am stuck in catching enqueued style. I try to optimize website for PageSpeed. Site use plugin WPBakery Visual Composer as WYSIWYG editor. Every block supports Google Fonts, which added with ...
2
votes
2answers
748 views

How do I set up a child-theme without using @import

I've always used @import for the css in my child-theme which i'm now told is bad practice. What is the best way to set up a child theme going forward? The latest solution on the wordpress codex ...
1
vote
1answer
78 views

Plugin CSS not enqueing

My apologies if there is an answer to this already making this a duplicate question, I have spend the last 3 days trying to get the CSS styling to be applied in a way that WordPress would allow, it is ...
0
votes
3answers
3k views

Find a Parent Theme's stylesheet $handle when it registers a stylesheet

I have a child theme where I'm using the old @import to import in the CSS and I know this is no longer best practice. I've seen on the Wordpress codex how to do this properly, which seems ...
2
votes
2answers
5k views

Prevent CSS/JS loading when plugin is not used

I have a Wordpress theme (the7) that includes the Visual Composer plugin. This is good for my clients editing stuff in the back end, but it also adds unnecessary CSS and JS to every page load on the ...
6
votes
3answers
19k views

Why is the Child Theme Stylesheet Not Loading?

I'm using the HashOne theme and created a child theme in order to make various color changes to our website. However, the changes I've made to the child theme stylesheet are only taking place in the ...
1
vote
1answer
317 views

How remove render blocking css from wordpress when you build a theme?

Is there any good way to avoid render blocking css (google page speed) from Wordpress. Probably more complex, but find a way to add in theme development. It means, not something very specific but ...
0
votes
1answer
417 views

Why is style.css not loading through the functions.php

<?php /* # ======================================= # functions.php # # The theme's Function # ======================================= */ /*---------------------------------------*/ /* 1. ...
0
votes
2answers
144 views

Stooping a css file from loading in the header

I'm using the plugin 'Ninja From' and I'm trying to stop it from loading a CSS file in the header. The CSS file: <link rel='stylesheet' id='nf-display-css' href='http://example.com/wp-content/...
2
votes
1answer
3k views

How to maintain wp_enqueue_style dependencies set in parent theme style enqueuing

My parent theme's style.css has a dependency on bootstrap.css, which is also part of the parent theme. From parent themes functions.php: wp_enqueue_style('bootstrap', get_template_directory_uri().'/...
0
votes
0answers
209 views

Font Awesome not loaded on first page of website only - divi theme

I am new to WordPress and I created a WordPress website using DIVI theme, I have used font awesome on the website but unfortunately fonts are not loaded on first page of website only, I am getting 404 ...
0
votes
1answer
2k views

How to avoid loading same script twice?

Lets say the case is "owl carousel". 1- Should you register it as "owlcarousel" or "xyz-owlcarousel" with your theme / plugin prefix ? 2- If 2 or 3 theme / plugins use the same handle "owlcarousel" ...
0
votes
2answers
56 views

One Site. One Theme. Multiple Stylesheets without plugins?

Greeting Community, Here’s my challenge: We have an annual report that is published annually. We do NOT want to spin up a new site and domain each year, but house each previous year’s edition on the ...
0
votes
1answer
51 views

First element/selector of enqueued CSS file breaks

I have successfully enqueued a CSS file using wp_enqueue_style. I have verified that the CSS I am using for all my settings and selectors is correct. Indeed, all styling is applied except for the ...
3
votes
2answers
575 views

Identifying the priority of style.css so I can make a small CSS file load last

I have a small bit of hourly-changing css and I want to keep it in a second file (apart from style.css) and load it after my theme's style.css file. I believe I can make it load before style.css by ...
1
vote
3answers
3k views

How can I add style sheet link to my wordpress page

Example: I have following HTML code and where should I place that bootstrap.min.css link. If I place that link in HTML code itself, when the page is published it's not loading the CSS. <!DOCTYPE ...
0
votes
1answer
50 views

Shortcode inside text widget do not call enqueue style

I did a plugin who call enqueue style inside a shortcode. But when i add my shortcode in a text widget the enqueue style are not included en the page. wp_enqueue_style('css-rfnb', RFNB_PLUGIN_DIR_URL ...
1
vote
1answer
333 views

enqueue styles for only mobile wp

I tried to enqueue some styles on mobile only using wp_is_mobile() function, but it always give me true, Here is the code (From functions.php file) : add_action('wp_enqueue_scripts','...
0
votes
1answer
466 views

Missing dns-prefetch link when using “nested” wp_register_style

Given this script: function register_styles(){ wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Oswald|Open+Sans'); wp_register_style('bootstrap', ...
4
votes
1answer
529 views

Adding customizer styles with wp_add_inline_style

As I told in an earlier question is have a theme with hundreds of mods, which I gather in one mod so I don't have to loop through all mods at every pageload. Now, the codex has you dump customizer ...
2
votes
2answers
3k views

Style.css in child theme is loaded before Bootstrap

When I enqueue Bootstrap with wp_enqueue_style(), Bootstrap is loaded after the child theme's style.css and will override style.css. One way to load style.css after Bootstrap is to enqueue style.css ...
1
vote
1answer
75 views

Optimizing WordPress's styles and scripts

I'm trying to optimize my website, get rid off unwanted scripts and styles. I wanted to ask what is the best way to do so. What is the difference between wp_deregister_script and wp_dequeue_script ? ...
1
vote
4answers
1k views

Enqueue stylesheet depending on template

I'm trying to enque stylesheet depending on template but unfortunetelly my code isn't working. What I am doing wrong? if ( is_page_template('single-location.php')) { function ...
0
votes
1answer
2k views

get_template_directory_uri() links to child theme not parent

I have created a child theme of a parent theme which shows correctly on wp theme selector and activates. I have created a style.css of said child theme with the following meta information: /* Theme ...
0
votes
1answer
480 views

Different ways to load child theme css

I've noticed that when I load the CSS for a child theme in the way shown here: https://digwp.com/2016/01/include-styles-child-theme/, I get double entries in the chrome inspector for my CSS rules, and ...
0
votes
1answer
527 views

Parent theme CSS overriding child CSS rules

This seems like a common problem but as I modify my child themes style.css the parent style.css rules override any changes I make. One of the main solutions seems to be to correctly enqueuing your ...
0
votes
1answer
38 views

I want to set global directory locations for my CSS and JS locations. How?

I want some sort of variable to do what bloginfo( 'stylesheet_url' ) does. Except in a different location! Is there any way to set global directory locations? Or am I stuck with copying the old ...
2
votes
1answer
42 views

De-registering parent style sheet css recommended?

Just a general question: I am just wondering, why every tutorial for child themes still includes the parent's stylesheet. Would it not be preferable to de-enqueue & to de-register the parent's ...
1
vote
2answers
67 views

functions.php not hooking up with style.css

I'm starting to build a WordPress theme from scratch. I have MAMP all loaded and running on my computer and WordPress is loaded fine. I have the below three files all in the same folder C:/MAMP/...
1
vote
1answer
38 views

Never Enqueued Stylehsheet

I never Enqueued the main stylesheet I'm using on my Wordpress site in the functions.php doc. I just uploaded the stylesheet to the site. Everything works, but I now want to dequeue the stylesheet on ...
0
votes
1answer
2k views

How to pass variables from one function to another or combine functions

I have two functions: 1st - Takes care of all customizer options 2nd - Generates an inline style from those options In first function I set variables from which I create customizer settings and ...
1
vote
2answers
295 views

Font Awesome changing default WordPress Font

I have a WP Plugin where i use Font-Awesome Icons. I added the Font-Awesome folder to my Plugin Files and told WordPress to use them: // add font-awesome to admin area function ecp_admin_enqueue($...
0
votes
2answers
1k views

I created a child theme and it doesn't work for some of the css files

I have a template with 4 css files: rtl.css, style.css, main.css, bootstrap.css. rtl.css and style.css are located in my template root, for example: my_template_root/style.css. main.css and ...
2
votes
2answers
139 views

How can I enqueue a style only when a particular widget is active?

I have a plugin which requires a style sheet for the widget. I am trying to register the stylesheet when the widget is created, however the style sheet is not being queued and the styles ignored. The ...
0
votes
1answer
47 views

Javascript and Stylesheet in child page

I am trying figure out how to place JavasScript and stylesheet to parent page and children page via functions.php. The parent page is Our People and children page is staff names. This is what I wrote:...
3
votes
1answer
232 views

How to use parent theme's enqueue methods

According to the codex, when creating a child theme, you have to manually enqueue the parent theme's scripts. My parent theme has logic to conditionally display various css files, cached css, and ...
3
votes
2answers
1k views

How to force stylesheet to load before anything else in header?

I need a stylesheet to be added to the header before anything else. That means before any styles or scripts that are automatically added by any of the plugins I'm also using. I figured I could add ...