Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 answers
11 views

How to override Bootstrap css with my child theme css in wordpress?

I am trying to load my site's child theme's css after Bootstrap CDN css in wordpress. I tried using these code but it doesn't work. The Bootstrap css is not overriden. What should I do to fix that? ...
user avatar
  • 1
0 votes
1 answer
12 views

Add wp_add_inline_style into another wp_add_inline_style for better performance

function loadOneStylePage(){ wp_enqueue_style( 'main-style', get_template_directory_uri() . '/styles/main.css', array(), _S_VERSION ); wp_enqueue_style( 'main-style-separate-file', ...
user avatar
  • 1
0 votes
0 answers
32 views

Adding google fonts to WordPress theme

I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue ...
user avatar
0 votes
0 answers
22 views

Dynamically add Js

I have a basic bunch of CSS/Js files defined in my functions.php file. There I register and enqueue those scripts and stylesheets. But in specific situations I want to load additional scripts based on ...
user avatar
0 votes
0 answers
17 views

Load CSS before Theme CSS

I have a stylesheet I want to load first in the head before other plugins load css or theme css. For some reason priority is not working for me. Any idea how I can achieve this? I need to use ...
user avatar
  • 1
1 vote
0 answers
35 views

How to check if a WordPress core block is active in sidebar

I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code: // if has audio block. if (has_block('audio')) { wp_enqueue_style('audio-...
user avatar
1 vote
1 answer
30 views

Enqueue scripts not working with if is page conditional tag in functions.php

Is this even the correct way of including scripts on a specific page? function insert_mapsvg_scripts() { wp_enqueue_style( 'mapsvg_css', site_url('/mapsvg/css/mapsvg.css') ); wp_enqueue_style( '...
user avatar
  • 111
1 vote
1 answer
121 views

Enqueue styles in new site editor in WordPress 5.9

In the block editor for posts and pages, I used to use the enqueue_block_editor_assets hook to enqueue styles for the block. add_action( 'enqueue_block_editor_assets','load_assets_in_block' ); ...
user avatar
0 votes
1 answer
71 views

How To Load wp_add_inline_styles

I'm using this PHP code to modify default CSS inline via functions.php however its not working. <?php add_action( 'wp_enqueue_scripts', 'inline_bar_width' ); function inline_bar_width() { if (...
user avatar
  • 447
0 votes
1 answer
31 views

What is the colors handle from WordPress core for and why does it not have a path?

Looping through $wp_styles->registered, the handle colors is outputted with a $wp_style->src of 1. Searching through WordPress core, it isn't immediately clear what it's for. The code is: ...
user avatar
  • 151
0 votes
1 answer
71 views

Can only override parent theme styling with '!important' in child style.css

function my_theme_enqueue_styles() { wp_enqueue_style( 'twentytwentyone-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', ...
user avatar
  • 17
0 votes
0 answers
33 views

Filter enqueued styles and scripts

I am looking for a way to reorganize the scripts/styles queue in WP. I am well aware of the fact altering the queue may have undesired effects, but in this case there are solid reasons for doing it ...
user avatar
0 votes
1 answer
40 views

Enqueue CSS on custom posts' backend area

I'd like to insert some CSS on a specific post type's backend area. So not globally. I've found lots of ways to insert it everywhere, but can't figure out how you'd target posts only. Any ideas?
user avatar
  • 21
0 votes
1 answer
24 views

Why would the child theme load in the Customize preview, but not on the site itself?

I have my child theme folder, the style.css sheet with the required template comment and some custom css, and I have the functions.php page with the required enqueing code. Everything seems to be in ...
user avatar
0 votes
0 answers
24 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, ...
user avatar
0 votes
1 answer
83 views

make admin.css in my child theme

i want hide elements of admin with css file "my-admin.css" I put css file "my-admin.css" at the root of my child theme wordpress and use this code in functions.php but does not ...
user avatar
0 votes
1 answer
41 views

Custom WordPress Theme loads js but not stylesheets

I have looked around as best I could, but I could not find a solution to this problem. I am building a custom WordPress template from scratch and the stylesheets won't load. For some reason, the ...
user avatar
  • 103
0 votes
0 answers
64 views

Enqueue css to a third-party plugin template

The frontend Dashboard page on my website that uses my custom theme is displayed by a third-party plugin. The plugin supports its templates override, so I replaced the plugin's header template with my ...
user avatar
  • 115
2 votes
3 answers
631 views

Enqueue script o style only if a template part is loaded

I have registered some styles and scripts that should be loaded if a template part is loaded in a template file. For ex: in home.php <?php get_template_part( 'template-parts/external_links'); ?> ...
user avatar
0 votes
0 answers
42 views

Creating a WP plugin and having issues linking CSS stylesheet within functions

Creating a WP plugin for third party usage (first time doing this), and typically links to stylesheets are put in the header or in the theme generated options panel. That's fine for personal use but ...
user avatar
0 votes
0 answers
22 views

wordpress plugin add page when activate

I have written a WordPress plugin and want to make new page when plugin activate I tried by the following its loading only html its not including css style-sheet which is included in html file if ( ! ...
user avatar
2 votes
1 answer
263 views

.editor-styles-wrapper overriding my block styles in Gutenberg

I'm working on my first theme built from custom gutenberg blocks. I've managed to register blocks and enqueue their specific stylesheets, but I'm running into one issue that's kind of a pain. A lot of ...
user avatar
  • 31
0 votes
0 answers
71 views

Why does using wp_register_style without wp_enqueue load and print CSS tags in the front-end?

I have this piece of code that registers a CSS in a child theme and when visiting the front-end my_css is actually included. Why is that ? I thought that registering meant registering for later use to ...
user avatar
0 votes
0 answers
21 views

List WordPress plugin stylesheets

I know how to find stylesheets with wp_styles, but I don't know how to find plugin's stylesheets, that are not referenced in wp_styles.
user avatar
0 votes
1 answer
44 views

How to add styles to a submenu page?

I'm relatively new to WordPress and, I am creating this plugin, where I need a submenu page. I have successfully created the main page and have added CSS to it without any problems. However, I came to ...
user avatar
0 votes
0 answers
62 views

What's the most efficient way to preload multiple font types using links and enqueue?

I added some code to my theme to preload my self-hosted enqueued fonts that are coming in via @font-face. I then added a filter to set the attributes. Seems to work and the pages load a bit faster too....
user avatar
1 vote
1 answer
106 views

Is my approach to enqueue styles inefficient?

I'm kinda new to wordpress and programming in general. I have the following question. Recently I came across this article and wanted to use this approach in the wordpress theme I'm working on. I wrote ...
user avatar
1 vote
0 answers
70 views

How to enqueue JavaScript file that depends on CSS stylesheet

I'm trying to set up a build process for JS/CSS assets to work with my WordPress theme. In my JavaScript file, I can do this: // src/button.js import React from 'react'; import './Button.css'; ...
user avatar
  • 133
1 vote
1 answer
94 views

How to remove plug in styles for WPForms Lite [closed]

I would like to remove the preset style sheets that WPForms Lite applies to its forms. So that I can use my own and not have to cause excess bloat by overriding the preset stylesheet. Currently, I ...
user avatar
0 votes
1 answer
106 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() { ...
user avatar
0 votes
1 answer
24 views

theme style is applied on the dhasboard rather than the website

I am creating a new theme, I created a new directory called mytheme and created three files directly inside the directory where the content is as follow: index.php <?php echo "hellow world&...
user avatar
0 votes
1 answer
221 views

Add custom css file after plugin css with Wordpress Child Theme functions.php

I am trying to enque a css file thorugh my child themes functions.php after a specific plugin css file with the handle openpos.bill.bootstrap. Unfortunately the current code does not load anything. ...
user avatar
  • 121
0 votes
2 answers
93 views

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

get_queried_object returns NULL inside a function hooked to wp_enqueue_scripts action hook when going to an nonexistent category URL on my website. If the category exists, the error is not shown and I ...
user avatar
0 votes
1 answer
267 views

How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)

I’ve created a plugin for my child theme, in which custom functions are stored. Additionally, within the plugin, I'm also enqueueing stylesheets and .js which control the output of two templates, for ...
user avatar
  • 15
0 votes
1 answer
41 views

How to add CSS via custom plugin?

I am making my first plugin. I create a folder in \wp-content\plugins, create a test.css and a test.php file. Here is my test.css: body { background-color: red !important; } Here is my test.php (...
user avatar
  • 308
0 votes
1 answer
19 views

404 Not Found on CSS file even though it's in the correct directory

This is in the template file: function add_pt_style() { wp_enqueue_style ('pt-style', ROOT_PATH.'/pt.css', array(), '1.0.0'); } add_action( 'wp_enqueue_scripts', 'add_pt_style' ); get_header(); ...
user avatar
0 votes
0 answers
75 views

Save custom option in CSS file

I have built this script in order to display a CodeMirror in a plugin and through the CodeMirror integration I can inject and save CSS in the head of the website, the result is very cool but I would ...
user avatar
1 vote
1 answer
79 views

WP CLI Get all Enqueued Scripts and Styles

Normally, I would hook into the wp_enqueue_scripts action in order to gather a list of enqueue'd scripts and styles. However, I have a very intensive process I need to run, thus instead of running it ...
user avatar
  • 139
1 vote
1 answer
35 views

Enqueue script/style if certain widget has certain value

I want to build a widget by which various social media sharing buttons can be added to front end. In the widget form there will be many checkboxes for social media. Since these sharing buttons require ...
user avatar
0 votes
0 answers
36 views

style.css is not loaded in other template files than index.php (eg. front-page.php)

I am a Wordpress newbie who just started to go through this tutorial: https://developer.wordpress.org/themes/basics/including-css-javascript/#stylesheets So i created a new theme and activated it. ...
user avatar
  • 1
0 votes
0 answers
24 views

Problem with displaying CSS Stylesheets - Am I adding them correctly in my wordpress child theme?

Is this a proper way to load CSS files into my WordPress child theme? add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); add_action( 'wp_enqueue_scripts', 'case_studies_styles' ); ...
user avatar
0 votes
1 answer
80 views

My CSS suddenly doesn't load anymore [closed]

I've did some small changes on my CSS, nothing crazy, uploaded them to my website. Cleared my cache and suddenly, the website doesn't show my custom styles. Website: http://experienceantwerp.be/ My ...
user avatar
  • 125
0 votes
1 answer
53 views

Enqueued style gets commented if not logged in

When using stylesheets I like to use wp_enqueue_style to have wp handle the loading. For some reason this works perfectly fine when I am logged in. But when I am not logged in the include statment ...
user avatar
1 vote
2 answers
783 views

How to enqueue style in WordPress plugin from theme files?

In my theme files I enqueue many css and js files. I want to enqueue some css files which are same as theme. So, how I can enqueue in plugin ?
user avatar
4 votes
2 answers
1k views

Get parent theme version

How do I get the parent theme's version in a child theme? I want to use it when loading the parent theme's stylesheet. Here's how I load the stylesheets in the child theme's functions.php file: ...
user avatar
0 votes
2 answers
2k views

filemtime(): stat failed warning within a child theme

I am trying to work on my child theme, but I can't get rid of the filemtime(): stat failed warning, which appeared as soon as I activated my child theme. After reading other questions, I understand ...
user avatar
  • 3
0 votes
1 answer
50 views

How to make my shortcode load scripts and styles, from within the plugin?

This sounds like a silly problem, but I was searching for an answer, and couldn't find anything. And the things that I did find, I tried and didn't work or were very vague. Content My Problem What I ...
user avatar
0 votes
1 answer
355 views

How to enqueue stylesheets in child-theme functions.php?

I know this topic is old hat, but I still got issues with that. I use the elementor child-theme and try to enqueue the following stylesheets hello-child-theme-folder: style.css hello-child-theme/...
user avatar
0 votes
1 answer
30 views

Dequeing Parent Fontawesome Deques Parent Styles

I'm trying to dequeue fontawesome from a parent theme in my child theme. For this I use the following code: function si_dequeue_child_styles() { wp_dequeue_style('wp-bootstrap-starter-fontawesome-...
user avatar
0 votes
1 answer
273 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) ...
user avatar

1
2 3 4 5
12