All Questions
156 questions
24
votes
2
answers
12k
views
How can I use WordPress functions in my stylesheet?
I have my style.php file looking like this.
<?php header('Content-Type: text/css');?>
#div{
background:<?php echo get_option('bgcolor');?>;
}
This does not work, but when I do this ...
26
votes
3
answers
43k
views
TinyMCE: adding CSS to format dropdown
I successfully added a TinyMCE stylesheet using add_editor_style() so that I can preview the styles in the body of the TinyMCE editor.
However, am I right in assuming that the add_editor_style() ...
29
votes
3
answers
97k
views
Versioning @import of parent theme's style.css
Context
I built a child theme based on Twenty Thirteen which works quite well. After updating the parent theme to version 1.3, I noticed strange behavior with the styling which was caused by a cached ...
19
votes
4
answers
2k
views
Customizing a WordPress theme without changing it?
I have found and downloaded a theme. However I want to tweak the CSS some to change the design, colours etc. a bit. How should I go about doing this, while still being able to update the theme without ...
39
votes
7
answers
52k
views
Best way to overide plugin CSS?
Currently, I use CSS specificity to override plugin styles. I prefer this for editing the plugin as it makes less headaches when you update.
It would be nice if my style sheet loaded after the ...
27
votes
5
answers
28k
views
How do I add CSS options to my plugin without using inline styles?
I recently released a plugin, WP Coda Slider, that uses shortcodes to add a jQuery slider to any post or page. I am adding an options page in the next version and I would like to include some CSS ...
14
votes
3
answers
26k
views
How to add a custom CSS class to core blocks in Gutenberg editor?
I'm trying to add a class to list blocks (core/list) in Gutenberg. Unfortunately, it looks like because some blocks like lists and paragraphs don't have the standard default class name of wp-block-{...
5
votes
9
answers
5k
views
Remove top admin bar
whenever admin or any other user logs in a top bar menu ads up. Now I made login for everybody, so I do not want this bar.
First I added display:none to admin-bar.css, but the main problem is that ...
10
votes
1
answer
8k
views
Restricting a Plugin to Only Load its CSS and JS on Selected Pages?
I'd like to cause a plugin to restrict its loading of CSS stylesheets and JavaScript JS files to only those pages for which they are needed.
An example for my question is the plugin Contact Form 7 ...
10
votes
1
answer
6k
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' );
});
...
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['...
22
votes
4
answers
79k
views
SSL Breaks Wordpress CSS
We purchased an SSL certificat from network solutions (would never recommend them to my worst enemy, btw).
Apparently it's activated... did a few checks that says it's activated for our domain. But ...
7
votes
1
answer
3k
views
Enqueue Stylesheets After Theme's "rtl.css"
I am currently developing a theme with internationalization support, and would like to load stylesheets after my theme's rtl.css (an alternative style.css loaded for languages with a right-to-left ...
32
votes
2
answers
48k
views
Where are Additional CSS files stored
This image shows the Additional CSS feature in Wordpress. I'm trying to find the file that stores the additional CSS, but can't seem to find it anywhere - I've searched almost every folder in wp-...
20
votes
2
answers
13k
views
How to add crossorigin and integrity to wp_register_style? (Font Awesome 5)
I am upgrading Font Awesome 4 to version 5 which introduces both integrity and crossorigin attributes to the <link rel="stylesheet"> markup.
Currently, I am using:
wp_register_style('...
11
votes
5
answers
6k
views
Do I actually need to link my theme's style.css in the theme files
So I am developing a wordpress theme using a series of LESS files for the CSS. These compile using codekit to a combined and minifed stylesheet that I use for the theme's styling.
I understand a ...
11
votes
6
answers
34k
views
WordPress Admin Bar Overlapping Twitter Bootstrap Navigation [closed]
I am having an issue with the WordPress admin bar overlapping the Twitter Bootstrap (2.3.0) nav bar. I have tried this fix:
body.admin-bar .navbar-fixed-top {
top: 28px;
}
.navbar .brand {
...
10
votes
1
answer
21k
views
How to enqueue style before style.css
How do I enqueue a .css file before style.css is loaded? Or make the default style.css dependant on another .css file?
I'm trying to load a .css reset, which style.css would overwrite.
Here's what I ...
8
votes
1
answer
20k
views
How do I cleanly override a plugin's CSS with a child theme?
I have taken it upon myself to adhere to WordPress conventions so I can have a clean, sexy child theme. However, I am unsure how to proceed on a certain issue.
I would like to override the CSS for ...
8
votes
3
answers
19k
views
How do I load a CSS style into WordPress admin area only?
I'm trying to load a CSS file for my WordPress post area, but having no luck. I have read over the wp_enqueue_style function and came up with the code below, but it doesn't load up. Is there a tag or ...
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 ...
3
votes
2
answers
1k
views
Modify CSS via Theme Control Panel
Hi to all I'm trying to create an advanced control panel for my first Wordpress template but I'm not able to add a function that I will need.
The function that I'm trying to add is the possibility to ...
1
vote
2
answers
8k
views
adding a custom css class to post
essentially I need to be able to add a class to a post when it show in the list (say index.php) so when in the back end you can say oneCol, twoCol, threeCol and it will then output this within the ...
41
votes
3
answers
115k
views
adding custom stylesheet to wp-admin
im having troubles getting my custom stylesheet work on WP-ADMIN area.
plugins_url('style.css', __FILE__) ); do i have to create folder in my plugins named css or do i just copy my .css to the wp-...
32
votes
10
answers
70k
views
How do you avoid caching during development?
Is there a simple way to prevent all caching when testing the appearance of changes to the site? I use WP Super Cache. I can delete its cache using the option provided, delete the cache for my ...
28
votes
4
answers
3k
views
Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?
WP has a nice javascript loader included in wp-admin:
http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-scripts.php
and a CSS loader:
http://core.trac.wordpress.org/browser/tags/3.0.4/...
16
votes
7
answers
28k
views
Attributing a version number to a child theme's main stylesheet
In header.php, I like to attribute a version number to the stylesheet so that the browser gets forced to refresh it. But when working with a child theme, its stylesheet is not explicitely called, ...
14
votes
3
answers
24k
views
Wordpress admin stylesheet
Is there a way to override the styles in the admin in my theme?
I don't want to touch the admin style sheet if I don't have to.
I just want to make a column bigger in my admin, but also, to do it in ...
11
votes
4
answers
7k
views
Enqueue Google Web Fonts Without Messing Up Symbols In URL
Enqueuing Google Web Fonts the usual way, i.e., using the wp_enqueue_style function like so...
function wpse_google_webfonts() {
wp_enqueue_style( 'google-webfonts', 'http://fonts.googleapis.com/...
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 ...
9
votes
3
answers
7k
views
CSS classes for theme
Does anybody know predefined (suggested by WP) CSS classes which should I use in my theme?
I have seen somewhere in Internet a list of all CSS classes, which are used in WP theme, but can't find it.
...
7
votes
5
answers
13k
views
Customizing wp-activate.php
Does anyone know how I can customise wp-activate.php?
It wraps the content in <div id="content" class="widecolumn">, however in my theme the main wrapper is <div id="main">
Presumably, I ...
7
votes
6
answers
6k
views
Sanitize User Entered CSS
Does anyone have any idea how to sanitize CSS entered via user input? I am concerned about cross-site scripting via CSS. I am using wp_filter_kses to clean up user entered HTML, but I need a like ...
5
votes
2
answers
6k
views
How to customize the default HTML for Wordpress Attachments
I'm using Wordpress 3.0.1 (most recent as of now) and working around the Whiteboard theme.
It seems that for attachments (images, specifically), Wordpress generates the HTML automatically and it ...
4
votes
1
answer
3k
views
How to target with css, admin elements according to user role level?
I am using plugins "Capability Manager Enhanced" and "Adminimize". Between these two I have been able to do much of what I want to do.
There are still some elements I need to hide and have been able ...
3
votes
2
answers
680
views
Add a preview to a Wordpress Control Panel
I'm trying to create a new wordpress template and inside it I added a Control Panel, inside this control panel there is an option that allows user to choose where he want's to place a on a map, I try ...
3
votes
3
answers
3k
views
Add class to before_widget for all widgets with a dropdown and a counter
Some predefined widgets offer the option to use a select element (dropdown) and/or a counter after each entry. How can I add the CSS classes widget-with-dropdown or widget-with-counters to these ...
3
votes
1
answer
2k
views
How to apply a class to the second word in menu list item?
I want to apply a class to a word in my menu. For example, say I have a list item in my menu called "My Item". I would like to apply a class to the word "Item" so that I can style it anyway I want.
...
3
votes
2
answers
10k
views
Add CSS class to every image
I want to add a CSS class "myimg" to every image both inside and outside of a post. What is the best way to approach this?
3
votes
1
answer
11k
views
Making WordPress Gallery (.gallery-item) Responsive?
Shortcode for Gallery: [gallery link="file" columns="5" size="medium"]
I’m using a 5 column gallery on an inner page of a website, obviously when the site responds down to mobile and even tablet ...
2
votes
1
answer
1k
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 ...
2
votes
3
answers
3k
views
Override CSS settings of plugins
I want to override my plugin CSS settings, but I can't do that in my style.css file, because the plugin CSS gets loaded after.
Is there a way of getting style to be applied to override plugin CSS?
2
votes
1
answer
6k
views
Wordpress wp-admin suddenly lost its style
NB: I originally posted this on SO, but I was recommended to try here - sorry for the duplicate!
I'm really baffled about this. In the last couple of days (since I was using the site last), my ...
1
vote
1
answer
283
views
Big side banners
I would like to have a big header side advertisements like this:
What is the best way to achieve that?
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( '...
1
vote
3
answers
3k
views
Can't edit style.css in subdirectory of my theme?
I want to edit a file style.css but the theme editor shows this:
/* ---------- Reset Tags ----------- */
@import url("css/reset.css");
/* ---------- Reset Tags ----------- */
@import url("css/...
1
vote
2
answers
1k
views
Adding dashicon fonts to the admin of pre 3.8 installs
I've started using the dashicon fonts in my theme options page for WP 3.8+ users. To take care of users on < 3.8, I've added the dashicon fonts to my theme folder and also an entry at the top of my ...
1
vote
3
answers
9k
views
Why won't child theme's style.css override plugin's css
I am using my own child theme for twentyeleven, and I've made some changes to some plugin's css classes in my child style.css. The problem I'm having is that if I add a new css attribute to a class ...
0
votes
1
answer
148
views
Templates & CSS - Proper Programming Practice?
I've worked with WP/html/css casually for a long while but never dug deep before, I have a few questions about good practices.
My Background - totally skip this if uninterested
I've been left ...
0
votes
1
answer
192
views
Performance and styles not working fine after changing permalink structure
Fist I was using default option of permalink and everything was fine (speed is ok, my own created theme is working fine) but now I change default structure to post name structure of permalink now I am ...