• I’m trying to create a custom theme and everything was going as suspected until now. I’m using MAMP for my local environment and so far I only have the index, header, footer, functions and css files.

    My initial styling worked fine but now I can’t make changes. It strange because I can comment out all of the styling and nothing changes, but if I comment out the wp_enqueue_style function I do lose the styling. It’s like I’m stuck with the styling I did up to this point.

    This all starting happening after adding my custom logo.

    here is my functions.php file

    <?php
    
    // ADD CUSTOM STYLESHEETS
    function custom_theme_assets() {
      wp_enqueue_style('style', get_stylesheet_uri());
    }
    add_action('wp_enqueue_scripts', 'custom_theme_assets');
    
    // REGISTER PRIMARY MENU
    register_nav_menus(['primary' => __('Primary Menu')]);
    
    // Add CUSTOM LOGO
    function custom_logo_setup() {
     $defaults = array(
     'height'      => 100,
     'width'       => 400,
     'flex-height' => true,
     'flex-width'  => true,
     'header-text' => array( 'site-title', 'site-description' ),
     );
     add_theme_support( 'custom-logo', $defaults );
    }
    add_action( 'after_setup_theme', 'custom_logo_setup' );

    Here is the code for adding the logo in my header file

    <?php 
       // maintain backward compatibility with the older versions of WordPress
       if ( function_exists( 'the_custom_logo' ) ) {
         the_custom_logo();
       }
    ?>

    I only give you this because the problem started after I worked on the logo. I tried removing this code but nothing changed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s strange, it shouldn’t be happening because of just a logo change. Check your code and error log to see if something comes out there.

    Moderator bcworkz

    (@bcworkz)

    Adding the logo shouldn’t affect CSS. It’s unusual in a localhost environment, but sometimes browsers aggressively cache CSS files so changes to them fail to appear until after the browser cache is flushed. Try flushing just to rule that out.

    I suspect a simple syntax error in the file. This can cause all subsequent CSS to be ignored. Try validating your file.
    https://jigsaw.w3.org/css-validator/

    Thread Starter lgehrig4

    (@lgehrig4)

    I replied to this last night but must not have hit enter. It was my text editor. The issue stopped only after restarting it. Thanks for the info though. I’m sure I’ll come across that as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Theme CSS Stopped Working’ is closed to new replies.