All Questions

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

Dequeue Scripts and Style for Mobile not working?

I've followed a few tutorials on Dequeueing and Deregistering scripts and styles for WP - trying to optimise my site speed. Initially I could dequeue and deregister, until I added a condition for ...
1
vote
0answers
644 views

Font Awesome 5 Free - far working but fas is not? [closed]

This is making me crazy. I'm using Font Awesome 5 Free in custom list styles using :before and content: In every instance, far icons are working and fas icons are not. I've checked everything I ...
0
votes
1answer
289 views

Using wp_add_inline_style Inside a Template File

I'm trying to figure out how to get wp_add_inline_style to work inside a template file. The code I'm using is this: function custom_css() { $output = '.some-class { background: #000; }'; ...
0
votes
2answers
356 views

I can't add CSS with functions.php [SOLVED]

I'm relatively new to creating a theme with WordPress, and I've been adding all the stylesheets (main and for each page) with the old echo get_stylesheet_uri();. But I find out that this isn't the ...
1
vote
1answer
76 views

Advantages of using <link> instead of wp_enqueue_style()?

I'm working on a child theme for a base theme that mixes equal parts of <link> CSS and wp_enqueue_style() CSS. This base theme has me thinking - I don't see any advantages to using <link>, ...
2
votes
3answers
189 views

Is it possible to use the featured image of a page as a css background without inlining?

So, I'm totally new to WordPress and trying to "convert" a static site to a WP theme. I have a page where I'd like to use the featured image as a background for a div. I was wondering what is the ...
0
votes
1answer
402 views

How to remove ID's from wp_enqueue_style?

How to remove ID's from wp_enqueue_styles ? Check below picture
0
votes
2answers
1k views

Disable wp_enqueue_style for theme on wp-admin

At this moment I use functions as described in the "Theme handbook" from the WordPress site. The problem is that the stylesheet is loading on the backend pages too and it affects the layout of the ...
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 ...
1
vote
1answer
313 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
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" ...
3
votes
2answers
473 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
1answer
292 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','...
4
votes
1answer
498 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
1answer
40 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/...
0
votes
1answer
33 views

Different stylesheet for different pages not working fully

I am trying to use different stylesheets for different pages, but it doesnt kinda work. For example i made a page called 'Contact' and assigned the template contact-template.php to it. and this is ...
0
votes
2answers
475 views

Ideal inline dynamic CSS injection

There is a code in here that dynamically load custom script. <?php function my_styles_method() { wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/css/...
0
votes
1answer
2k views

How to output wp_enqueue_style() in HTML head instead of footer

I added some actions to wp_enqueue_scripts to load my custom css and js files in the header section by using wp_head(); right before the closing </head> tag. function mytheme_scripts(){ // ...
2
votes
2answers
3k views

Enqueued Stylesheets Effecting Admin Styles

I'm building a custom theme for a client and I've been adding stylesheets incorrectly for a while, so I decided to do it the correct way :-). However, when I add the stylesheet to my functions.php ...
2
votes
1answer
773 views

Adding inline styles from a widget

I'm working on a theme that has an optional widget to allow users to put some site elements where they want. One of those is a list of social media icons. These are font icons, so they can be styled ...
14
votes
3answers
14k views

Using wp_add_inline_style without a stylesheet

I need to add custom inline styles to the header of a custom theme I'm creating. I've come across the wp_add_inline_style() function, which works but doesn't really suit me as it depends of a specific ...
3
votes
1answer
920 views

Get info (url) from already enqueued styles

I am building a theme and using Easy google fonts WordPress Plugin. I created several typography controls within Theme Customizer for Post content,Post header, Author page content, Single Post content,...
-1
votes
1answer
71 views

Enqueue script/style with multiple GET parameters

I am trying to enqueue a style with two GET parameters, but the output is not correct. Here's what I have: wp_enqueue_style('colors-css', '/root/assets/css/colors.css?style=blue'); The problem is, ...
1
vote
1answer
171 views

Theme Loading Into Dashboard

I'm having this really weird, never seen before, issue ... whenever I visit the Dashboard, after about 3-5 seconds, my theme loads into the Dashboard layout. It's like the theme's stylesheet is being ...
0
votes
0answers
77 views

How to enqueue stylesheet after rtl.css? [duplicate]

When you use rtl language by default wordpress enqueue rtl.css file at the end of all stylesheets. what I need is how to enqueue a stylesheet after rtl.css stylesheet so the result should be like the ...
0
votes
2answers
111 views

Some questions about how proper add 2 CSS file in a WordPress theme?

I have the following situation loading a CSS. I have a WordPress theme that load a style.css settings file by this code into my functions.php file: /* Function automatically executed by the hook: * ...
5
votes
2answers
2k views

Why I can't add a CSS style in this WordPress theme?

I am trying to add a CSS style to a WordPress theme that I am developing as is shown in this tutorial: http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/ ...
10
votes
1answer
5k views

Enqueue a stylesheet for login page and make it appear in head element

I try to style the login page in my theme. Very simple: add_action( 'login_enqueue_scripts', function() { wp_enqueue_style( 'TEST', get_template_directory_uri() . '/css/login.css' ); }); ...
0
votes
1answer
65 views

How to include a file only on dashboard widgets page?

I want to add some styles to the widgets input fields. Therefore I want to include a style.css file only on the wp-admin/widgets.php page. How can I detect the above page and include file there?
0
votes
1answer
165 views

get_template_directory adding FTP root folders in urls

I am creating a theme, and now I am adding some functionality for my custom post type, such as different metaboxes in post page, extra post config page. It seems when I try to get the sites theme ...
0
votes
4answers
475 views

enqueue_style is not working

I try to load the main stylesheet with enqueue_style - but it isn't working. Here is my code from functions.php: function my_scripts() { wp_enqueue_style( 'main-style', ...
1
vote
3answers
470 views

The best way to add stylesheets to WordPress

I am in the process of converting a mobile responsive page, currently built in Bootstrap into WordPress. Using wp_register_style() and wp_enqueue_style() will add the stylesheets to all pages, ...
2
votes
5answers
13k views

How to add dynamic inline style?

I want to add dynamic CSS, so currently I am adding directly to the div, ie: $color = "#000000"; echo '<div style="background:'.$color.'"> Is it bad to add code like above? I have read in ...
0
votes
1answer
187 views

Why enqueue styles on hook?

Why do we need to enqueue styles on a hook, why not just enqueue them straight in like this? wp_enqueue_style( $handle, $src); the codex page gives an example of using a hook but doesn't explain why ...
1
vote
1answer
325 views

How can I let templates choose which stylesheets are enqueued?

My theme's functions.php hooks into wp_enqueue_scripts to register a couple of stylesheets that are used by various site pages. Here's a simplified version of my configuration: add_action("...
0
votes
2answers
131 views

How do I use a color from theme options?

I am building a theme, and in the options I have created a place for link color. I cant seem to get this into the theme in any reasonable way. The best I can do is to put it after wp_head ... but that ...
2
votes
3answers
4k views

What can I hook into after_setup_theme?

I'm wondering what can I or should I NOT hook to after_setup_theme? I'm wondering because I have been told that I shouldn't hook wp_enqueue_style to it, but I have seen other places using it to hook ...
0
votes
1answer
279 views

Having issue with WordPress wp_enqueue_style

I am building a full design into WordPress for the first time and I am trying to load in stylesheets and script files but all I seem to be getting is the text output of the location. What I have is ...
19
votes
3answers
3k views

How important is it to enqueue a theme's stylesheet?

I have trawled the net looking for an answer to this, but for some reason all I can find are actual examples, but without that particular explanation, which is clear say in the case of scripts. Can ...