Home Forums WoodMart support forum Default css for theme does not load … sometimes

Default css for theme does not load … sometimes

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #497974

    apxxtemos
    Participant

    Hello,

    I have the following problem: Sometimes the base styles for the themes inside the script tags with the id “wd-style-theme_settings_default-css” are not loaded. Everything else works fine. There are no erros or warnings. This happens sporadically and I can’t figure out what causes this.

    I looked at the source code and found the files helper.js and combine.js, which seem to load the styles. But I don’t understand what’s going wrong, that prevents the styles from being attached to the head section of the document.

    The problem is, that without these basic styles, the website looks broken.

    The solution I found by accident, is to initiate maintenance mode and deactivate it again. After that the styles are being loaded again. But this has to be done manually by the admin, if the error occurs and is noticed by someone from the staff.

    Do you have any idea?

    Thanks in advance for your help and thanks for this so far awesome theme, which I am using for several projects for some years now
    Alexander Häusler

    #498020

    Luke Nielsen
    Keymaster

    Hello,

    Could you please make a video for a better understanding of how can I replicate that issue on my side?

    Thank you in advance.

    Kind Regards

    #498100

    apxxtemos
    Participant

    Hello Luke,

    thanks for the quick reply. But unfortunately, I can’t give you any video on how to reproduce this problem. If I could, I would have already fixed the issue, because I’m a software engineer. I stopped digging in the source code, because I thought you maybe have an idea, what could cause such a behaviour.

    I will look further and will tell you the solution to the problem and how it is caused, as soon as I find out 😊

    Kind regards
    Alexander

    #498122

    apxxtemos
    Participant

    Hello again,

    i found out, that the themsettings are generated in the file themesettingscss.php. Can you tell, how this data is sored? There is a woodmart_stylestorage class used. How is it stored? In files? I Think the problem is caused by some caching issues. Somehow the file is probably not loaded from the storage and the maintenance mode switch resets the creation of this themesettings css file.

    Am I on the right track?

    Kind regards
    Alexander

    #498276

    Luke Nielsen
    Keymaster

    Hello,

    Yes, you are right, this file generates a style file with the name wd-style-theme_settings_default-css. But for the first time, we hear that there are some problems with this functionality, therefore, we can assume that your problem may be caused by some incorrect custom code of the style or an incorrect value added to the setting control that generates the style.

    Kind Regards

    #498314

    apxxtemos
    Participant

    Hello again,

    I found the issue and you are probably right, that this has something to do with another plugin. For my custom code, I haven’t used options in this particular project.

    So it seems that the option entry for the default theme style css gets erased somehow. So the flag in the stylestorgae is still 1, but the entry is gone. And so nothing is loaded because the object attributes say, there is css data given.

    I “solved” the problem inside the stylestorage.php file in the function is_css_exists(). and added
    return $this->is_css_exists && !empty(trim($this->css)); In my case this will be evaluated to false and therefor the option entry is regenerated from the exisiting file.

    Looking at this code, I think the option js_css_exists is a bit useless, because if it is 1 the variable css is always none empty. I don’t know if the performance is a huge difference comparing for an empty string vs. comparing a boolean or integer that is 1 / false.

    Kind regards and thanks for the quick help
    Have a nice weekend 🙂
    Alexander

    #498925

    Luke Nielsen
    Keymaster

    Hello,

    Glad that you have sorted it out.

    Always remember that you can reach out to us with any questions you may have.

    We wish you a splendid day!

    Kind Regards

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

The topic ‘Default css for theme does not load … sometimes’ is closed to new replies.