2

css is not working. It's weird because I see it in the head of my html when I view it with my browser inspector... but its not picking up the new css I add to it. I tried clearing my catch. this is my child theme style.css

/*
Theme Name: Venedor Child
Template: venedor
Version: 1.0
*/

.select2-container .select2-selection--single .select2-selection__rendered {
    padding-left: 164px!important;
}

#s2_form_widget-2 form {
display: none;
}
a.checkout-button.button.alt.wc-forward {
    display: none;
}

p.alert.alert-success {
    font-weight: bold;
    font-size: 1.3em;
}

textarea#order_comments {
    font-weight: bold;
    font-size: 1.5em;
    line-height: 1.4em;
}

and this is my child's theme functions.php

<?php
add_action( 'wp_enqueue_scripts', 'venedor_child_enqueue_styles', 33 );
function venedor_child_enqueue_styles() {
    $parent_style = 'style';
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'venedor-child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}

Any Ideas???... again I see the child theme style sheet in the head of my pages... just not with the changes I'm making in my wp-admin editor. Thanks!

Dan Baker
  • 21
  • 1
  • 2
  • Have you verified that the child theme CSS file is being loaded? Not just a `` appearing in the head? Are your CSS selectors in the child theme as specific or more specific than those in the parent theme? Have you verified any of the above through Dev Tools? – hungerstar Feb 27 '18 at 16:59
  • What do you mean by "it's not working"? Please explain what your desired outcome is, and how it differs from what is actually happening. – Adam Barnes Feb 27 '18 at 17:12

2 Answers2

4

I have had similar issues with browsers and getting it to update my CSS. In Chrome I had the best success with doing a hard reload (or refresh). To do this, press Ctrl+Shift+R in Chrome. Other browsers have similar ways to accomplish this, mostly pressing Ctrl then clicking refresh.

Chris

1

You're missing the wp_register_style step to enqueing a CSS asset and have tried to list wp_enqueue_style twice, causing your stylesheet not to get loaded. Here is roughly how to do it (can be different for different parent/starter themes):

function venedor_child_theme_enqueue_style()
{
    wp_register_style( 'venedor-child-style', get_template_directory_uri() . '/style.css', array(), '20180227', 'all' );
    wp_enqueue_style( 'venedor-child-style' );
}
add_action( 'wp_enqueue_scripts', 'venedor_child_theme_enqueue_style' );

The third array parameter of wp_register_style is important: you need to tell WP which parent stylesheets of Venedor this new stylesheet is related to. It's an array, so look up how to do PHP arrays correctly (they can be wonky). The 5th parameter tells WP which devices to send this too - I set it to all but you could change that.

A Note: The Venedor documentation makes this theme look outdated. It was created in 2014 and has only seen minor updates since then from what I can tell. This theme is designed for non-coders, so you're going to continue to run into problems like this if you use this as your base for a new site.

If you're just trying to tweak some spacing or something in your theme, they offer a very specific set of styles to move stuff around (check the styles page on that documentation link). You probably can also tweak those font-sizing properties inside the theme itself and save yourself from a separate stylesheet.

If you are starting a new site from scratch, stop using themes like this as a crutch and build from scratch. You'll actually save yourself time this way: instead of hunting around someone else's documentation and trying to figure out how they did it, you'll learn how to do it yourself. Try out Sage, it's the gold standard WordPress starter themes and will force you into becoming a better developer.

serraosays
  • 7,163
  • 3
  • 35
  • 60