Support » Theme: GeneratePress » Custom css not working

  • I have been designing my site with free generatepress and child theme but if I add my custom css it affects only the desktop unless i add it directly to “additional css” in theme customization located in appearance.
    I have below function..

    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
    
    add_action( 'wp_enqueue_scripts', 'tu_child_theme_enqueue' );
    function tu_child_theme_enqueue() {
        wp_enqueue_style( 'child-theme-style', get_stylesheet_directory_uri() . '/custom.css');
    }

    but it doestn’t affect the mobile view when I check on my phone. Thanks in advance to whoever will help.
    Currently I have my css on “additional css” and its too many that it slows my site.

    • This topic was modified 2 years, 10 months ago by ysgmesh.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    GeneratePress automatically looks for a style.css file in your child theme directory, so you shouldn’t need the tu_child_theme_enqueue() function at all.

    Can you try using the style.css file instead?

    Let me know 🙂

    Thread Starter ysgmesh

    (@ysgmesh)

    I have tried style.css and it works now… I removed those lines and its working but I am still testing to make sure its not a cached version. Thanks very much but there a problem now.
    My site says “Multiple tabs are being controlled by the same service worker. Close your other tab on the same origin to audit this page”
    This appears on chrome and I cant understand why. It seems this is the reason my site is scoring very low on speed test.
    Can you suggest for me on this?

    • This reply was modified 2 years, 10 months ago by ysgmesh. Reason: It is solved at this moment although I am still testing it
    Theme Author Tom

    (@edge22)

    Hi there,

    I’m not sure what that means – does it only happen in Chrome? What if you use Incognito mode?

    Thread Starter ysgmesh

    (@ysgmesh)

    It happens when I want to use chrome audit tool to run a test on my site. Please I am still having that issue and I cant really understand why its happening. You can check my Site with chrome through “insight — audits” and you can see it. Please I will like if this can be resolved. Thanks for your assistance and hardwork

    Theme Author Tom

    (@edge22)

    I’m not seeing that error in my Audits tab. Perhaps it’s something with your browser?

    Have you tried in Incognito mode?

    Thread Starter ysgmesh

    (@ysgmesh)

    Alright mentor….I have seen its fine on incognito mode maybe I have to reinstall my chrome but the question I ask is why does it actually happen to my site alone whereas others run fine. Thanks a million times.

    Theme Author Tom

    (@edge22)

    Unfortunately I don’t know enough about that message to know for sure.. It could be one of your browser extensions?

    The good news is that it’s likely not an issue for other visitors to your site 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom css not working’ is closed to new replies.