Skip to main content

All Questions

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

plugin not loading my css and js

Hi I'm using the standard way to load styles and scripts within my plugin. But I have no clue why it's not working. It's not shown in the network tab nor in the <head>. Can this cause issues ...
Jan's user avatar
  • 33
0 votes
1 answer
491 views

Correct way to enqueue page specific CSS file

I am looking for an alternate way than using functions.php and applying conditionals based on each page's ID, instead I would like to enqueue the CSS right at the top of each page like this: <?php ...
Raging Vids's user avatar
0 votes
0 answers
248 views

Advanced method to control cache of enqueued style/script

I have a WordPress website with medium-level traffic, ~10,000 unique visitors a day. Arround 30% of my daily visitors are recurrent. I constantly make some UI improvements: colors, font-size, ...
Alexandro Giles's user avatar
0 votes
1 answer
299 views

Dequeue styles with query doesn't work

In my theme there is the following code (that is printing some inline css on the head of my site) final class Design_Scheme { /** * Design_Scheme constructor. */ private function __construct() { ...
Honoluluman's user avatar
0 votes
1 answer
921 views

How can I force Dynamic CSS via ACF values to update on page load?

I'm trying to dynamically change the background color of a post on scroll to colors set in post options via an ACF color picker. I was able to source enough code examples to get it working (I thought) ...
rconrad41's user avatar
0 votes
1 answer
38 views

Changing the CSS with a plugin

I'm trying to make a plugin that changes the CSS file. My client want to change the colors each season, and we want to make it foolproof so they won't break anything. I've managed to create the option ...
mennobrein's user avatar
1 vote
0 answers
27 views

How to integrate my HTML and javascript into my child theme

I have a javascript script, html, and css I put together on JSfiddle that I now need to essentially put on a page in wordpress. I'm using a child of the generatePress theme. I'm doing it this way ...
Alexis Richard's user avatar
0 votes
1 answer
197 views

Bootstrap Integtration

I wonder how can I integrate only bootstrap 4 grid system instead of : <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-...
ahmet kaya's user avatar
1 vote
3 answers
2k views

Enqueue All Stylesheets Found In a Theme Folder

Is there a built-in Wordpress function that will allow you to enqueue all stylesheets for a particular theme? I have a directory structure that looks like: -my-custom-theme -css -header....
Lloyd Banks's user avatar
0 votes
2 answers
2k views

functions.php - inject inline css from file

I would like to read from a .css file and inject it as an inline style in wp_head. it's possible? i've tried this "Add inline css to theme" solution but it doesn't do what I expect because I expect ...
Erik's user avatar
  • 11
0 votes
0 answers
92 views

Enqueue CSS and Script only if needeed

How can I enqueue a CSS code only on the pages which use that CSS? Usually it's quite easy to know if a particular CSS or JS is used on a WordPress Post: it's enough to check if the shortcode is used ...
Revious's user avatar
  • 323
1 vote
0 answers
133 views

Styles and scripts inside template part

Is there anything wrong with including style and script tags inside a template part? The template part which I'm using like something more similar to a vue/react component is working correctly but ...
feedmeimhungry's user avatar
0 votes
0 answers
578 views

Enqueuing multiple stylesheets with a child theme

I've successfully enqueued a parent stylesheet and child stylesheet. I'd like to enqueue a third - ultimately a style.php file, but a second-style.css would be a good start. It's not working for me ...
JohnG's user avatar
  • 344
0 votes
1 answer
994 views

enqueing Javascript and CSS

Whenever I check my website on gtmetric, google Insights, Pingdom etc... I always get feed back of render blocking JS Currently I enqueue all my scripts as so: <head> <link rel="...
Paulmcf1987's user avatar
3 votes
3 answers
3k views

Relative path instead of absolute for wp_enqueue_script

When you enqueue scripts or styles with the following: function themeslug_enqueue_style() { wp_enqueue_style( 'core', '/style.css', false ); } add_action( 'wp_enqueue_scripts', '...
Troy Templeman's user avatar
0 votes
2 answers
758 views

Load custom CSS before admin CSS

I am trying to use the jQuery Datatables plugin in my WordPress dashboard but the native WordPress admin CSS styling is overiding the datatables CSS, I am calling them like this... add_action('...
fightstarr20's user avatar
  • 1,135
4 votes
2 answers
11k views

How can I dequeue a Plugin Stylesheet?

I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css. I would like to remove this Plugin's Stylesheet, since it is being ...
Craig's user avatar
  • 358
0 votes
1 answer
843 views

How do I dequeue a Stylesheet, stored in an 'Assets' folder?

How do I dequeue a CSS Stylesheet located in wp-content > themes > theme-name > assets > css > theme-skin > color.css? The outputted code, within the Source Code, is: <link rel='...
Craig's user avatar
  • 358
1 vote
1 answer
2k views

How to insert html/css/javascript code to wordpress plugin

I'm trying to show a modal dialog when user get registered (action_hook: user_register) using the woocommerce plugin, but without having any result. I would appreciate any help! The code is shown ...
fmp's user avatar
  • 11
0 votes
1 answer
1k views

Child theme stylesheet not always overriding "index"

I'm using a child theme and I'm using a "styles.css" file to override things from the parent theme. My styles (there are many stylesheets) are enqueued like this: function my_theme_enqueue_styles() { ...
Sergi's user avatar
  • 260
0 votes
1 answer
47 views

Theme JS is available but theme CSS isn't

In functions.php I used the following code to enqueue assets, but for some reason all CSS is ignored (JS isn't ingonred): function my_theme_enqueue_assets() { wp_enqueue_style( 'parent-style', ...
Arcticooling's user avatar
0 votes
1 answer
28 views

Including CSS files in HEAD based on page content

For example: I have a plugin that adds a box to the page. Box requires CSS file and JS file. Box can be added via shortcode, or via PHP or via widget. My question is - how to include CSS & ...
Marvin3's user avatar
  • 663
1 vote
0 answers
874 views

Bootstrap and Custom CSS in custom plugin are being overwritten by theme

This is my first plugin, and I'm having a real hard time figuring out enqueuing styles/scripts. All the code I wrote for the plugin works great, but I'm having issues with stylesheets and Bootstrap. I ...
Coltvant's user avatar
  • 187
0 votes
1 answer
124 views

Is it good practice moving the main stylesheets after the plugin styles?

currently I deleted the 'classic' hardcoded main /styles.css from header.php and enqueued it from a wp_enqueue_scripts action. Basically, the loading order in header I currently want (and have) is: [...
Luca Reghellin's user avatar
0 votes
1 answer
3k views

wp_enqueue_script was called incorrectly Issue when active plugins of WordPress Admin Bar Improved

I am getting the error with the following message when i active my plugins "WordPress Admin Bar Improved": Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be ...
Alvin Soh's user avatar
0 votes
1 answer
47 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 ...
Dr. Chocolate's user avatar
13 votes
2 answers
22k views

How to load scripts/styles specific for a page

I know that according default Wordpress boot process, firstly functions.php is called, after that goes all theme stuff. But I am currently going to refactor my theme completely to optimize it. My ...
CROSP's user avatar
  • 447
23 votes
5 answers
42k views

How can I get a list of all enqueued scripts and styles?

I'm creating a plugin and I want to get the list of all scripts and CSS used by other plugins. This is my function: function crunchify_print_scripts_styles() { $result = []; $result['...
Edouard Kombo's user avatar
0 votes
2 answers
69 views

My stylesheets are not enqueuing

I'm in Wordpress 4.5.2 on Windows 10 and I'm trying to register and enqueue my stylesheet in Wordpress, but it just isn't working. I'm having the same problem with jQuery. I have this code in a ...
Dan Luba's user avatar
1 vote
2 answers
142 views

How do I load custom scripts and styles for a page?

Different pages often need different set of scripts and styles for them. I use functions.php and construction like this to load scripts and styles: function load_assets() { wp_enqueue_style( '...
Boykodev's user avatar
  • 337
2 votes
2 answers
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 ...
erwstout's user avatar
  • 302
1 vote
1 answer
95 views

Do I need to register my own created .js and .css files

I have several .js and .css files which I created for my theme. (not a child theme) Styles and scripts are at the moment hard-coded in the head and work as wished. Now I read a lot about register and ...
Jerry.S's user avatar
  • 140
0 votes
1 answer
128 views

wp_enqueue_scripts and CSS

I know wp_enqueue_script has the ability to have a dependency which is great. Now what if I can't give it one? What if all I want is for it to be the last script in the list of generated CSS ...
Jason's user avatar
  • 11
5 votes
2 answers
4k views

Use wp_enqueue_scripts, not wp_print_styles?

Everywhere is said that you need to use wp_enqueue_scripts() instead of wp_print_styles(). wp_print_styles() is located in wp-includes/functions.wp-styles.php. So what does it mean? What should I ...
user avatar
0 votes
1 answer
742 views

Custom Plugin - CSS works, JS doesn't

In the plugin I'm making, I use separate js and css files (____.js, ____.css). This is the first time that I've included an external .js file in anything. I'm registering and enqueueing both in the ...
Mike's user avatar
  • 3
7 votes
7 answers
11k views

Can I add styles to footer with $wp_styles->add_data?

I'm working on a script to easily move js and css scripts to the footer using the add_data function in $wp_scripts and $wp_styles. I know for scripts that if the group is greater than 0 the script ...
Jeremiah Prummer's user avatar
0 votes
1 answer
139 views

Custom CSS not being added by plugin

I am attempting to add custom css through my plugin. I do have wp_head() called in my header. My code is - /** * Enqueue plugin style-file */ function prefix_add_my_stylesheet() { ...
ILikeTurtles's user avatar
0 votes
2 answers
943 views

is there a way to get all queued scripts/styles into a template without `get_header()`?

in my main plugin page i check if a certain page is visited if so, i load a certain template. in the following way: add_filter( 'template_include', array($this, 'includeTemplate'), 99 ); public ...
Neta Meta's user avatar
  • 251
1 vote
0 answers
2k views

get_template_directory_uri() gives me wrong path when I try to use wp_enqueue_style

In my functions.php I use wp_enqueue_style and wp_enqueue_script as I read this is the correct way to add stylesheets and scripts to pages. But as my host has this sub folder where the install goes ...
user1225840's user avatar
5 votes
2 answers
3k 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/ ...
AndreaNobili's user avatar
0 votes
0 answers
136 views

Change Login CSS - Include instead of echo

I'm trying to figure out how to include a stylesheet instead of echo'ing <style> tags. I'm currently using the following function: // Custom Login Styles function login_styles() { echo '&...
Austin Biggs's user avatar
2 votes
1 answer
2k views

if file_exists not working with wp_enqueue_style

Inside a function I'm doing something like this: $optional_css_exists = get_template_directory_uri() . "/css/optional.css"; if ( file_exists($optional_css_exists) ) { wp_enqueue_style('...
teamcrisis's user avatar
9 votes
8 answers
15k views

How to add stylesheets only to pages with specific shortcode?

I'm running a function on pages where the shortcode [make-me-a-map] is used. It enqueues javascript to the page and makes a map. That part works fine (woot!) but I'm having trouble with adding the ...
Padraic's user avatar
  • 93
0 votes
1 answer
187 views

Ordering stylesheet above <style> using functions.php

I'm loading a stylesheet and a style into the header using functions.php. This works but the stylesheet is being presented below the <style>. I need to order the stylesheet above the style block....
ditto's user avatar
  • 117
8 votes
3 answers
37k views

Hook 'wp_enqueue_scripts' priority has no effect

In a theme I am working there are up to 3 Stylesheets. I am using the hook 'wp_enqueue_scripts'. The order of the stylesheets is important for overwriting styles. I have a code like this: add_action('...
Markus Schober's user avatar
4 votes
1 answer
2k views

How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?

How would I go about combining multiple CSS files and concatenating my scripts if they're being enqueued as WordPress recommends? My site is pretty slow and would like to optimize for performance.
Matt's user avatar
  • 1,131
1 vote
1 answer
3k views

Custom Admin CSS styles to style media uploader?

Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed. ...
speedypancake's user avatar
0 votes
1 answer
67 views

Wordpress Plugin Authoring question about jquery and css

When I'm writing a plugin, do I assume that jquery is included, or should I always wp_enqueue_script it and let wordpress figure it out? Also, what's the best practice for getting an image path ...
Scott Phillips's user avatar
10 votes
1 answer
9k views

wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i'm confused

I've been reading up a bit on this subject, but the more I read - the more confused I get. Can someone explain to me in short what's the exact difference between wp_enqueue_scripts, ...
ptriek's user avatar
  • 857
0 votes
1 answer
577 views

Enqueuing a script before anything else

I wondered if it was possible to change the order in which a script is enqueued. I ask this because I wish to include the HTML5 enabling script but it needs to be included before any styles. Is ...
Wolfy87's user avatar
  • 115