Web Analytics Made Easy -
StatCounter Wordpress Child Theme css changes not effecting live website - CodingForum

Announcement

Collapse
No announcement yet.

Wordpress Child Theme css changes not effecting live website

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wordpress Child Theme css changes not effecting live website

    Hi All,

    So i have a wordpress website and purchased a theme (which came with a child theme too) the parent theme is set up so when displaying products on the site it displays 4 per row on a large screen and just 2 per row on a tablet device. I am trying to get it to display 4 products per row on a tablet too.

    I have found the code and files that i need to amend to get it to display how i want, i downloaded the files from the parent theme and then recreated the file directory in the child theme folder and uploaded the css files to the new directory. I then edited the css files in the child theme to reflect the changes i wanted and saved the file. I then activated the child theme and refreshed my website, but none of the css changes are taking effect, i don't think my website is even trying to use the new files. I'm obviously doing something wrong and it's frustrating the heck out of me.

    The files in question are
    plugin-style.css
    plugin-adaptive.css​

    and the file structure is as follows
    parent theme = wp-content/themes/kids-r-us/woocommerce/cmsmasters-framework/theme-style/css/​
    child theme = wp-content/themes/kids-r-us-child/woocommerce/cmsmasters-framework/theme-style/css/​

    the css for my child style.css and functions.php are as follows
    style.css
    Code:
    /*
    Theme Name: Kids R Us Child
    Theme URI: http://cmsmasters.net/kids-r-us-child/
    Author: cmsmasters
    Author URI: http://cmsmasters.net/
    Description: Kids R Us Child Theme
    Template: kids-r-us
    Version: 1.0.0
    License:
    License URI:
    Text Domain: kids-r-us-child
    Tags: one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
    */​
    and functions.php
    PHP Code:
    <?php
    /**
    * @package WordPress
    * @subpackage Kids R Us Child
    * @version 1.0.0
    *
    * Child Theme Functions File
    * Created by CMSMasters
    *
    */

    function kids_r_us_child_enqueue_styles() {
    wp_enqueue_style('kids-r-us-child-style'get_stylesheet_uri(), array(), '1.0.0''screen, print');
    }

    add_action('wp_enqueue_scripts''kids_r_us_child_enqueue_styles'11);
    ?>
    Can anyone please help me?
    Thanks​
    Last edited by LJackson; Jan 24, 2023, 05:38 AM.

  • #2
    It’s hard to tell because every theme works differently but often it isn’t necessary to change any specific theme stylesheets, you could just override the default styles from your child theme’s style.css file (i. e. put the styles that are supposed to override the default ones in the child theme’s style.css). I can see in the source code that the child theme’s style.css is loaded but only the parent theme’s plugin styles you were mentioning.

    There might be a theme documentation explaining how to extend things but I could imagine that this only works for PHP files, not for stylesheets. I’d suggest just using style.css to override styles.
    Stop solving problems you don’t yet have!

    Comment


    • #3
      Thanks for your reply Stephan, Yeah the documentation is very basic unfortunately and doesn't go into any specific details in relation to modifying the theme at all. However i did what you suggested and it worked a treat. Thank you very much for your time and help, it's much appreciated.

      Comment

      Working...
      X