New answers tagged

1

If you want to have specific CSS for visitors (aka not logged users) then you can take @HK89's code and tweak it a bit add_action('wp_head', 'add_css_of_current_specific_user_role'); function add_css_of_current_specific_user_role() { /*Check if it's a visitor*/ if ( !is_user_logged_in() ) { ?> <style> // Some CSS ...


1

You can add custom css on your html header using wp_head hook action & checking your current User Role add_action('wp_head', 'add_css_of_current_specific_user_role'); function add_css_of_current_specific_user_role() { /*Check Current User is Login*/ if ( is_user_logged_in() ) { $user = wp_get_current_user(); /*Check Current ...


0

i tried this code in the functions.php for showing to the guests this css how is that possible add_action('init', 'check_if_user_is_loggedin_function'); function check_if_user_is_loggedin_function() { if ( is_user_logged_in() ) { } else { echo '<style> .woo-variation-swatches.wvs-style-squared .variable-items-wrapper ....


1

You should remove an additional } on line 18. Try the following <?php if (!function_exists('understrap_scripts')) { /** * Load theme's JavaScript and CSS sources. */ function understrap_scripts() { // Get the theme data. $the_theme = wp_get_theme(); $theme_version = $the_theme->get('Version'); ...


0

It was just an example I Really want to put an function if the user is visitor or "role" then enable this css


0

The parent theme's functions.php has two functions to manage the editor styles. They are twentytwenty_classic_editor_styles() and twentytwenty_block_editor_styles() and they're both hooked to init. For example, the classic editor function reads: function twentytwenty_classic_editor_styles() { $classic_editor_styles = array( '/assets/css/editor-style-...


-1

In fact it was at line 1586 in the style.css file: but a question remains: how to use Chrome/FireFox Inspector to find the file in which we have to edit the .css? We were all wrong here and my question received 3 thumbs up, it means there is a general lack of knowledge around this topic. Any reply is welcome.


3

The inspector says "inline" which indicates that the CSS is not in a separate file, but instead is inside the HTML itself, probably in a <style> block at line 39 ( near the top ) - search the whole page source code for #masthead and you will probably find it. If you want to know how it is being added to the theme HTML, you will need to search ...


2

You can compare the post date to the date of your choice and enqueue different styles depending on the result: <?php function my_enqueue_styles_depending_on_date() { global $post; $style_switch_date = '20201230'; // the trigger date if ( is_single( $post->ID ) ) { $post_date = get_the_date( 'Ymd', $post->ID ); ...


0

Probably your CSS selector is wrong. You can filter the admin pages where your function runs and you can use an universal selector. global $pagenow; if (( $pagenow == 'edit-tags.php' ) && ($_GET['taxonomy'] == 'product_cat') && ($_GET['post_type'] == 'product') ) { add_action('admin_head', 'hide_category_buttons'); } function ...


0

There is some modification in your code, insted of this class .taxonomy-category tr:hover .row-actions apply css on this class .taxonomy-category .row-actions span.delete, it willl work. Here is whole code. add_action('admin_head', 'hide_category_buttons'); function hide_category_buttons() { echo '<style> .taxonomy-category .row-actions span....


0

It's actually not the image that is transparent. There is an overlay box on top of the image (and THAT is transparent). :-) There are several ways to fix it. The clean way To find the overlay in the backend and see if you can disable it. Or perhaps make it 100% transparent (opacity: 0). Depending on the theme, then this might not be an option, but I would ...


0

It sounds like you need the main body of the page to always fill the height of the viewport even when the content is shorter. Find out the height of the header first so you can calculate the remaining height of the viewport. .site-content { min-height: calc(100vh - [insert header height here] ); }


Top 50 recent answers are included