Support

Account

Home Forums General Issues Can't seem to load stylesheets when doing blocks?

Helping

Can't seem to load stylesheets when doing blocks?

  • I want to create seperate stylesheets for each block, however I never got it working so I always did bad workarounds..

    I tried using this:
    ‘enqueue_style’ => get_template_directory_uri() . ‘/template-parts/blocks/testimonial/testimonial.css’,

    I can however see in the source code that it’s trying to look for the css file in my parent theme. I trhen replaced “get_template_directory_uri()” with “get_theme_file_uri()” and I can now see that the stylesheet is being loaded like this:

    <link rel=’stylesheet’ id=’block-acf-tabell-css’ href=’http://stagingsite.mydomain.com/wp-content/themes/childtheme/template-parts/blocks/testimonial/testimonial.css?ver=6.0&#8242; media=’all’ />

    I can even press the link and it brings me to the right file, however the styles aren’t being applied. I tried doing this both on my personal sites which are developed locally, and on the enviroment of the agency I work at, which is done on live sites, with different themes – however I never got it working properly.. any idea on what I’m doing wrong?

  • I still have this issue. The stylesheet seems to be loading in the bottom of the page, which I guess is why the styles aren’t being applied.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.