Questions tagged [css]

Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics (the look and formatting) of HTML output, usually via Themes. When you have to use this tag, then there's a high chance that your question is off topic on this SE network site.

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

How to dequeue a stylesheet by src, not handle?

I'm trying to develop a Wordpress plugin that will dequeue/deregister Font Awesome stylesheets added to a theme by certain plugins that users may install, if the theme already make use of Font Awesome....
Knott's user avatar
  • 454
0 votes
1 answer
130 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 ...
Murkantilism's user avatar
0 votes
1 answer
1k views

Custom CSS for full post vs. excerpt (Content Options)

Is there a way activate "Full Post" via Custom CSS or any other way? Right now I am stuck with Excerpts on the Homepage and my Theme Customizer > is missing Content Options Here below is what my ...
KarmicP's user avatar
-2 votes
2 answers
339 views

How can I make content disappear when a user logs in?

I am working in Wordpress, and I would like to make certain elements disappear once a user logs in. How can I do this? I have social icons on my page that I positioned to the center of my menu bar at ...
chris hughes's user avatar
-2 votes
2 answers
3k views

PageLines theme: how to change the background color of the main content vs. entire page?

I use PageLines free version, with WordPress 3.3.1, for this website: http://new.teleosis.org/?page_id=76 I want the background color of the whole page to be light green, and the background color of ...
nomade0's user avatar
  • 27
57 votes
6 answers
74k views

What are the standard admin CSS id/class tags?

Is there a list of WordPress CSS id/classes that I can use to build plugin option screens that look and feel more like a normal WordPress option page? I have found some through serendipity but it ...
Ole Henrik Skogstrøm's user avatar
22 votes
2 answers
1k views

Is it ever okay to include inline CSS in plugins?

Normally in a plugin I would add styles using wp_enqueue_style. However, I am currently creating a plugin that only needs a few lines of CSS and I am wondering if it might be better to serve the ...
Dustin's user avatar
  • 374
20 votes
3 answers
4k 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 ...
byronyasgur's user avatar
  • 3,022
15 votes
9 answers
9k views

Adding first / last CSS classes to menus

is that possible, without javascript hacks? like this: <ul class="my_menu"> <li class="first"> ... </li> <li> ... </li> <li> ... </li> <li class"...
Alex's user avatar
  • 1,081
11 votes
4 answers
33k views

Why is style.css not being enqueued?

I got a pretty basic theme and just found out my style.css file doesn't get loaded into the <head>. I already searched around but can't find out, why it's not loading. I inspected the global $...
kaiser's user avatar
  • 50.6k
11 votes
3 answers
22k views

How to conditionally enqueue a stylesheet only for a certain page(s)?

Before I get started, I want to acknowledge that there are some really good articles that are targeted at how to conditionally enqueue scripts based on page/post content. WordPress Plugin Development ...
Evan Mattson's user avatar
11 votes
2 answers
2k views

show classes as dropdown in guttenberg`s additional css classes input box

I have set some css classes for the boxes in the Gutenberg editor, and I can type it in the additional css input box, it is not a problem for me, but for the client it is not convenient, because he ...
Botond Vajna'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
10 votes
8 answers
13k views

Are there Gutenberg container blocks?

In web design, a key design element is the container that may contain various other content and blocks and is styled in CSS. Is there a Gutenberg container block that may contain other blocks? If so,...
Wes Modes's user avatar
  • 205
8 votes
9 answers
22k views

How can I version the main CSS file?

How can I instruct wordpress to use a filename other than 'styles.css' for my main stylesheet - for example, styles-1.css? I'd like to do this for versioning and caching purposes.
Bobby Jack's user avatar
  • 1,252
8 votes
3 answers
36k 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
8 votes
3 answers
38k views

What is the correct way to enqueue multiple CSS files?

I am building a Bootstrap site on WordPress and need to be able include multiple stylesheets. However, when I enqueue them as follows, only the first and third style sheets show up in the page source....
forrest's user avatar
  • 483
7 votes
1 answer
7k views

How to specify a class added to my gallery

I would like to add a class to my gallery short code, this is how I have added my class: [gallery class="small" columns="2" ids="350,349,302,305"]. Now the confusion comes in, I am not sure how to ...
Charne's user avatar
  • 71
7 votes
1 answer
889 views

Assign a Class to the Current "Tag" for Formatting

Essentially what I am hoping to replicate is something like the "current-menu-item" class that is applied to WP Menus. My client is wanting to use Tags as a sub-nav, and I've managed to get the tags ...
John's user avatar
  • 333
6 votes
2 answers
6k views

Remove wp_add_inline_style

Is there a way to remove styles added with wp_add_inline_style? I noticed if I call wp_add_inline_style multiple times, it just keeps adding style, it does not overwrite what was added before. The ...
Toniq's user avatar
  • 437
6 votes
3 answers
37k views

Give priority to child theme stylesheet

I've created a child theme and the main style.css works perfectly fine. However, the parent theme has another stylesheet which I want to import and create the same for child theme and use it instead. ...
nimsrules's user avatar
  • 208
6 votes
2 answers
5k views

How to add a "last" class to the last post in loop.php?

I need to add a "last" class to the last post that appears in loop.php. Can someone tell me how to accomplish this?
user1462's user avatar
  • 1,284
6 votes
1 answer
2k views

How to work with custom styles saved in theme option?

I am creating a theme where user can save custom styles from theme customizer through settings API. Those style info are saved in options table as serialized data. When Custom skin is active I will ...
Sisir's user avatar
  • 7,782
5 votes
2 answers
2k views

Style new block-editor alignfull class without scrollbars or overflow

With WP 5.0 you can now enable full width blocks in the editor by adding this to your theme: add_theme_support( 'align-wide' ); However, if you are using a custom theme you have to add your own CSS ...
Trevor's user avatar
  • 717
5 votes
3 answers
3k views

how to include other plugins css files in a shortcode?

I've coded a plugin that creates a shortcode, among other things. That shortcode expects a post_id parameter, it extracts the content of that post and it returns the filtered content of that post (e.g....
Lucio Crusca's user avatar
5 votes
1 answer
9k views

How to use wp_dequeue_style() for style enqueued in WP_Widget class

I've got a plugin that makes a widget that enqueues some front-end CSS to style the widdget. I call wp_enqueue_style from the public widget() method in the extended WP_Widget class: <?php class ...
mrwweb's user avatar
  • 10.2k
4 votes
3 answers
13k views

How to add extra attribute to stylesheet link?

Following Keith Clarks advice, i'd like to load my fonts asynchronously. I try to achieve that by adding: wp_enqueue_style( 'font-awesome', URI . '/fonts/font-awesome/css/font-awesome.min.css' ); ...
Anna Oleksiuk's user avatar
4 votes
2 answers
8k views

How to set two different themes on one WordPress? (Desktop vs. Mobile)

I created two WordPress themes. First for the Desktop and second for tablet/mobile. I want to set on one URL. When the website opens, the theme should change automatically based on resolution.
Shafi Zahid's user avatar
4 votes
2 answers
5k views

Modernizr and WordPress - How can I add a CSS class to the html element?

The instructions for implementing Modernizr state that I should add class="no-js" to the <html> element. Is there a way to do this in WordPress using a hook or filter? If at all possible, I'd ...
tex's user avatar
  • 161
4 votes
2 answers
13k views

Custom CSS In Admin Only For Certain Roles

I'm looking to apply custom CSS in the admin only for a certain user role, "Contributor" to be exact. Everything I try either seems to have no effect, or produces a 500 error. What I've tried has in ...
CalvT's user avatar
  • 334
4 votes
2 answers
48k views

How to remove CSS file in the header using Wordpress functions?

I want to remove a CSS from loading in the header, this is the code that appears: <link rel='stylesheet' id='my-css' href='http://test.tld/wp-content/themes/mytheme/my.css?ver=3.5' type='text/css'...
Emerson Maningo's user avatar
4 votes
2 answers
12k views

How to add a class to ul tags created by the WordPress editor Tinymce?

I want to set a special styling for the ul tags created by Tinymce only, which means only for posts and pages, I only found this filter tiny_mce_before_init with an example on how to add custom style ...
Pierre's user avatar
  • 1,014
3 votes
2 answers
11k views

Which Details Are Required For Style.css File Header?

Which theme details are absolutely required for your style.css file header? I'm developing my first theme for personal use, so do I really have to include things like a license, license uri, author, ...
Derek's user avatar
  • 91
3 votes
2 answers
552 views

Use a higher than 230px logo image with 2013 theme

UPDATE: My question is not offtopic, because WordPress crops the logo image and not just CSS. I'm trying to use a 4724 × 2362 png image as a site logo at the top of a WordPress website with the stock ...
Alexander Farber's user avatar
3 votes
2 answers
6k views

how to make stylesheet appear in theme editor?

I have a stylesheet in my theme in the css subdir of the theme dir (css/style.css). The question is how to make this .css file appear in the theme editor of the WordPress admin. (I know using the web ...
NeuronQ's user avatar
  • 153
3 votes
3 answers
2k views

How to Add Admin Bar and Admin Menu or Submenu Notification Bubbles?

What would you recommend to use as far as manipulating the admin bar goes? I was thinking to just add a new admin bar node, and with CSS set a background image for the icon. Then in the node, just ...
Michael Ecklund's user avatar
3 votes
3 answers
571 views

Stylesheet switching and caching

I'm implementing a site that allows users to switch stylesheets (to show a high contrast version for people with vision impairments). The switcher essentially just changes the <link>ref to ...
anu's user avatar
  • 9,552
3 votes
1 answer
89 views

why does twenty eleven theme mix up the css measurement units?

I'm wondering why does WordPress's default theme mix up the css measurement units? For example: .one-column.singular #author-info { margin: 2.2em -8.8% 0; padding: 20px 8.8%;} Wouldn't be easier ...
Daniel's user avatar
  • 1,206
3 votes
1 answer
2k views

WordPress Shortcode and Dynamic CSS

I have a question I would like to ask to the WordPress developers, Usually when creating a shortcode that need to generate custom css how do you proceed? For example a simple button shortcode with ...
Lucas Selsek's user avatar
2 votes
3 answers
3k views

functions.php not adding css to website?

So I went through the forum to find a solution before I post a question, however I have yet to find it. I'm new to wordpress and I'm having a lot of fun learning on how to build my own website. ...
user avatar
2 votes
3 answers
2k views

"wp_enqueue_style();" don't load new edited style

First, sorry my english. I am using Local by flywheel to manager my site files and my wordpress version is 4.9.4. Here is the problem, When I use wp_enqueue_style('wharever', get_stylesheet_uri()); ...
DVDSON's user avatar
  • 23
2 votes
4 answers
7k views

How to add (css) classes to only one wp_nav_menu()?

Edit I removed the original Question as this Q has far above 1.000 views now - which means it's important to a lot of people - to show you something that works a) without a custom Walker & b) is ...
kaiser's user avatar
  • 50.6k
2 votes
2 answers
2k views

Twitter Bootstrap Use Collapse in Custom Post Type

I am using Bootstrap with Wordpress and I want to implement the collapse functionality in the content for single pages of a specific custom post type. I know I could create a shortcode, however, ...
stemie's user avatar
  • 490
2 votes
2 answers
2k views

wp_tag_cloud inline CSS

I am using wp_tag_cloud but my problem is the inline CSS (for the font-size). I am doing RWD so I need full control of my markup/css. As I saw there is no property that will make it go away, so I ...
George Katsanos's user avatar
2 votes
3 answers
8k views

Multisite configuration fails with css/js files

I have installed Wordpress using multisite + path (as opposed to subdomain). Seems to work, except JS/CSS files are not loaded. my conf: <Directory "/var/www/pages"> Options All ...
Itay Moav -Malimovka's user avatar
2 votes
2 answers
5k views

Override custom menu widget

I would like to override some mark-up and css (like <div class="soma_container"><ul class=""></ul></div>)styling on a chosen custom menu widget. How would I do that? Should be ...
fefe's user avatar
  • 874
2 votes
1 answer
3k views

CSS for Custom Post Types

How do I assign CSS to custom post types so it displays different from other Custom Post Types? Example: Custom Post Type 1: Row of 4 Images Custom Post Type 2: a 2 column with an Image in the ...
Joe Bobby's user avatar
  • 739
2 votes
1 answer
6k views

Add CSS animation as Preloader to WordPress

I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation, but I couldn't find any related help or plugin that would allow me to add a Preloader ...
Snazzy Sanoj's user avatar
2 votes
2 answers
4k views

How can I make new .css file in child theme override styles in child theme's style.css

I want to make a separate responsive.css file in my child theme but having trouble making the media queries override the styles in the child theme's default style.css. I've tried putting <link rel=...
user1794295's user avatar
2 votes
1 answer
15k views

Create a full width responsive header image per page

I’m new to Wordpress - currently building a site that has a few pages (Home, Artists, History, Videos). Each of those pages need a custom header containing a responsive full width image (the image ...
John's user avatar
  • 125