(Viewing 5 reply threads)
    • #996
      Erma Gerd
      Participant
      @erma
      Up
      0
      Down
      ::

      Anyone using LSCache the below snippet will address issues caused by Divi’s dynamic css calculation process. Without this snippet you can expect to experience issues.

      What will happen when you use this:
      * Page load one will be set to no-cache
      * Page load two will be a cache miss
      * Page load three will be a cache hit

      What will happen if you don’t use it:
      * Page load one will be a miss
      * Page load two will be a hit (but Divi’s dynamic css will be the same as page load one… which will be incorrect as it changes)

      add_action( ‘send_headers’, ‘dsl_check_cache_control_constant’ );

      function dsl_check_cache_control_constant() {

      if ( defined( ‘DONOTCACHEPAGE’ ) && DONOTCACHEPAGE ) {
      // set LS Cache Control Header to no-cache
      do_action( ‘litespeed_control_set_nocache’, ‘nocache due to Divi static file creation’ );
      }
      }

      [original FB post]

      • This topic was modified 8 months, 3 weeks ago by Terry Hale.
    • #1020
      Dee Zynah
      Participant
      @dee
      Up
      0
      Down
      ::

      Thanks for the tip. What issues does this solve, for instance?

      • #1023
        Erma Gerd
        Participant
        @erma
        Up
        0
        Down
        ::

        After any save/update, page load one and page load two are different as Divi calculates dynamic css on page load one and then applies it on page load two.
        LSCache (and likely some other caching plugins) cache page load one, thus you do not see the updated css on page load two.
        This snippet will address that issue.

        • #1024
          Lynne Guistic
          Participant
          @lynne
          Up
          0
          Down
          ::

          so you Are saying, just so i get it, I visit a website the First time, it shows me the website.

          You as website owner, changes something on the website the Day after i First visited the website, and of cource you clear all caches, in order to Update everything.

          The following Day, i visit your website Again, so i Will see the same thing as i Saw When i visited your website for the first time or Will i see your updated website?

          • #1025
            Erma Gerd
            Participant
            @erma
            Up
            0
            Down
            ::

            The website will not look different, but it will perform differently…

            Assuming you have either just saved/updated a page, or just cleared out the Divi static css files, when you load a page for the first time, it loads a lot of the css inline in the bottom of the body. At this point it calculates what css can be loaded late, what css is critical and a few other things but it doesn’t use that css “correctly” on the first page load because it doesn’t have the information until after the page is loaded.

            The second (and subsequent) times you load the page, it uses that information to load the page a bit differently – using critical css in the head, late css… later, static files linked etc.

            If a plugin or server cache, caches the page on the first page load… as you can imagine, it will just keep loading the page with all the css inline at the end of the body. It will still look the same, but you will likely have CLS issues and the page will also not perform as well as it could.

            If you want to see what’s happening, just clear the static css files, load a page and take a copy of the html. Then load the page again and compare the html – you will see it’s quite different and there are additional css files that were not present on the first page load.

    • #1029
      Mark Ateer
      Participant
      @mark
      Up
      0
      Down
      ::

      I’m not sure I understood. When I updated my sites with the new version of Divi, I had display problems. I cleared the LiteSpeed ​​cache but it didn’t change anything. Divi support told me to disable “Dynamic CSS”. What should I do about your recommendation? Reactivate Divi’s “Dynamic CSS” and add this code, is that right? Where should I add this code in this case? Thank you

      • #1031
        Erma Gerd
        Participant
        @erma
        Up
        0
        Down
        ::

        If you cleared LS cache and it didn’t solve the problem then the problem you are experiencing is unlikely to be related to LSCache and this snippet will not fix it – however you will still need to use it for LSCache to work properly with Divi.

        • #1032
          Mark Ateer
          Participant
          @mark
          Up
          0
          Down
          ::

          Where should I add this code ?

          • #1033
            Erma Gerd
            Participant
            @erma
            Up
            0
            Down
            ::

            In your child themes functions.php file

        • #1034
          Mark Ateer
          Participant
          @mark
          Up
          0
          Down
          ::

          what do this code exactly ?

          • #1035
            Erma Gerd
            Participant
            @erma
            Up
            0
            Down
            ::

            When the page is loaded it checks to see if a constant called DONOTCACHPAGE has been set and if so, it then uses the LS API to tell LS not to cache the page.

    • #1041
      Terry Hale
      Keymaster
      @mizagorn
      Up
      0
      Down
      ::

      Seems like a core testing issue wasn’t investigated or simply ignored. There is no way in the world that Divi’s is not going to be used on sites with major caching plugin/systems. How many users are going to be left chasing their tails, going round and round in circles trying to fix something that many will have no idea how to fix! It will be interesting to see if ET confirm they’ve tested it with all the other major players or not.

    • #1042
      Anita
      Participant
      @anita
      Up
      0
      Down
      ::

      Any one that can explain where to add the snippet?

      • #1043
        Ann Chovey
        Participant
        @ann
        Up
        0
        Down
        ::

        You need to be running a child theme. If you are then you go to Appearance -> Theme Editor -> functions.php -> and paste in this code. See attached example.

        Attachments:
        • #1045
          Anita
          Participant
          @anita
          Up
          0
          Down
          ::

          can i use snippet plugin to achieve this?

          • #1046
            Ann Chovey
            Participant
            @ann
            Up
            0
            Down
            ::

            I’ve never used that plugin since I routinely set up all my sites to run a basic child theme. However, I looked at the snippet plugin and it appears that it will work – “Code Snippets is an easy, clean and simple way to run PHP code snippets on your site. It removes the need to add custom snippets to your theme’s functions.php file.”

    • #1050
      Lynne Guistic
      Participant
      @lynne
      Up
      0
      Down
      ::

      Is this the right way to add the snippet?

      Attachments:
(Viewing 5 reply threads)
  • You must be logged in to reply to this topic.