• Resolved troyw2015

    (@troyw2015)


    Hi,

    I am using dFlip and have had to enable the Siteground Speed Optimiser, in order to resolve several other issues. However, since enabling it, the PDF book no longer loads. Instead I get the message ‘Error: Set a Valid Document Source’.

    By turning off Combine JavaScript Files in Speed Optimiser, I resolve the issue, but alas, all my other woes reappear. So I have tried to exclude the JS files and excluded /plugins/dflip/assets/js/dflip.min.js however this does not resolve the issue.

    Having tried everything I know, I wonder if you can point me in the right direction to fix this?

    You’ll find the book in the ‘Take a sneak peek….’ section of the page

    Thanks

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

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Daniela Ivanova

    (@daniellaivanova)

    Hello @troyw2015,

    I recommend you to try finding the exact handle that should be excluded in the manner explained in the How to Use SG Optimizer’s Filters (Procedure) forum topic.

    You can find an article with the full list of custom filters below:
    https://eu.siteground.com/tutorials/wordpress/speed-optimizer/custom-filters/

    The one that should be used for excluding a script from the JavaScript combination is:

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
    $exclude_list[] = 'script-handle';
    $exclude_list[] = 'script-handle-2';

    return $exclude_list;
    }

    As an alternative, you can also post a ticket through your SiteGround Client Area where our Technical support members will gladly take a look at the problem and will provide assistance in resolving it.

    Best Regards,
    Daniela Ivanova

    Thread Starter troyw2015

    (@troyw2015)

    Hi and thanks for your prompt response.

    I followed your link ‘How to Follow SG Optimizers Filters’ but the code does not generate anything when I select “Inspect Element.” Under “Styles,” and search for “handle” or “data-handle.” I get no results?

    The dFlip developer has suggested that I try to exclude df-shortcode-script but this does not appear in the list of exclusions. How can I add this or how can I find this Handle you speak of?

    Plugin Support Simeon Boev

    (@k3llanved)

    Hello @troyw2015,

    One of the steps provides a bit more information on how to check the handle you and its value:

    After the affected URL page has been loaded, right-click on the page (any location) and select “Inspect Element.” Under “Styles,” enter and search for “handle” or “data-handle.” Click here. You will then see a list of all styles and scripts with a “data-handle.” The “data-handles” presented are equivalent to the “style-handle” or “script-handle” noted in SGO’s filters. Click here for an example of what the results looks like.

    If you already have the handle there is no need to go through the trouble of searching for it. Use the snippet provided earlier and replace the script-handle field with “df-shortcode-script”:

      $exclude_list[] = 'script-handle';

    Plugins can utilize a wide variety of handles, which means not all of them are listed because there could be hundreds of entries.

    Best Regards,

    Simeon Boev

    Thread Starter troyw2015

    (@troyw2015)

    Hey Simeon,

    Yes, I have read the section you pasted above and it does not work.

    I installed ‘Code Snippet’ Plugin as instructed and added the following to the Functions PHP;

    add_filter( 'script_loader_tag', 'cameronjonesweb_add_script_handle', 10, 3 );
    function cameronjonesweb_add_script_handle( $tag, $handle, $src ) {
    return str_replace( '<script', sprintf(
    '<script data-handle="%1$s"',
    esc_attr( $handle )
    ), $tag );
    }

    I can see the code is there, but when I go into the Inspect and Styles, I search for Handle and get no results?

    The code is there now, so please check it in inspector yourself and you’ll see.

    I am a bit confused about these handles. Am I missing a step? Do I need to name something somewhere?

    Thanks

    • This reply was modified 1 year, 4 months ago by troyw2015.
    Plugin Support Simeon Boev

    (@k3llanved)

    The code is placed as intended and you just need to use the Inspector tool. Just search in the HTML(not Styles) for handle or data-handle and you will find the needed information.

    Thread Starter troyw2015

    (@troyw2015)

    OK, so I searched the HTML and found 22 data-handles. I can’t find any clues as to which is the right one, som tried these ones as they are in the area of the block. Still it doesn’t work!

    add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
    function js_minify_exclude( $exclude_list ) {
    $exclude_list[] = 'dflip-script';
    $exclude_list[] = 'wp-polyfill';
    $exclude_list[] = 'wp-url';
    $exclude_list[] = 'wp-api-fetch';

    return $exclude_list;

    }

    • This reply was modified 1 year, 4 months ago by troyw2015.
    Thread Starter troyw2015

    (@troyw2015)

    Also tried these;

    $exclude_list[] = 'wp-i18n';
    $exclude_list[] = 'dflip-script-js';

    Still doesn’t work?

    Plugin Support Georgi Ganchev

    (@georgiganchev)

    @troyw2015

    You can contact the support of dFlip so they can provide you with the exact handle to exclude, presenting them with the filter that my colleague provided should be sufficient for them to specify the handle.

    You can also open a Helpdesk request from the SiteGround Client Area should you need any help on our end.

    Best regards,
    Georgi Ganchev
    SiteGround.com

    Thread Starter troyw2015

    (@troyw2015)

    I have asked the developer for dFlip and this is the resoponse;

    The shortcode is handled by a function shortcode in Class DFlip_ShortCode . This is in file inc/shortcodde.php

        add_shortcode( 'dflip', array( $this, 'shortcode' ) );

    Not sure how are going to exclude php functions in cache.

    For HTML cache, in other cache plugins like wp-rocket, excluding the script class df-shortcode-script works

    <script class="df-shortcode-script" type="application/javascript">window.df_option_5413 = .................
    Plugin Support Georgi Ganchev

    (@georgiganchev)

    @troyw2015,

    You can open a Helpdesk request with detailed instructions on how we can replicate the issue with the PDF. Our Technical Support team will investigate further for you.

    Alternatively, you may wish to consult with a professional WordPress developer to identify the specific handle that needs to be excluded.

    Best regards,
    Georgi Ganchev
    SiteGround.com

    Thread Starter troyw2015

    (@troyw2015)

    Hey Georgi,

    As mentioned in my previous message, I have discussed with the actual plugin developer and this is what they have said. I have followed your directions and even excluded the dflip-script but it isn’t working. As I am a developer, I am certainly not paying another one to do exactly what I have been doing.

    I will go back to Dearhive Plugin developers, but like myself, they appear to be at a loss as to why your plugin doesn’t have proper exclusion options. Since SiteGround use this particular Caching system, its not ideal that the associated plugin is so restrictive.

    They have also reported this error from your plugin, which may be related? siteground-optimizer…bc13ffa2574afb.js:2 Uncaught Error: No Usercentrics script ID "usercentrics-cmp" found

    • This reply was modified 1 year, 4 months ago by troyw2015.
    Plugin Support Georgi Ganchev

    (@georgiganchev)

    @troyw2015

    The drop-down list displayed in the plugin contains JS files that have been implemented using standard coding procedures. Files that have been added without adhering to the recommended coding standards will not appear in the drop-down list.

    The “usercentrics-cmp” is unlikely to be causing the issue on the page, the error in the source indicates that when combined the script is trying to interact with the Usercentrics CMP but cannot find the required script or configuration on your site. It is likely you may want to exclude this script from being combined, it should be present int he list as /plugins/termageddon-usercentrics/public/js/termageddon-usercentrics-ajax.min.js

    After doing such changes it is important to flush the cache of your application and the Speed Optimizer cache for the changes to be reflected.

    Please open a Helpdesk request and include details of how we can replicate the problem and what breaks when the combination is enabled. This will help us further assist you by inspecting your website code and applying the filter to exclude the problematic handle.

    Best regards,
    Georgi Ganchev
    SiteGround.com

    Thread Starter troyw2015

    (@troyw2015)

    Hi Georgi,

    I excluded the /plugins/termageddon-usercentrics/public/js/termageddon-usercentrics-ajax.min.js but it did not fix the issue. I have passed this thread on to the dFlip developer, who has asked how to exclude inline scripts? Please advise.

    Thanks

    Plugin Support Simeon Boev

    (@k3llanved)

    Hello,

    You can exclude inline scripts from being combined using the following filter. Here’s a code snippet, you can add to your functions.php file to do so:

    add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
    function js_combine_exclude_inline_script( $exclude_list ) {
      $exclude_list[] = 'first few symbols of inline content script';
    
      return $exclude_list;
    }

    Best Regards,

    Simeon Boev

    Thread Starter troyw2015

    (@troyw2015)

    Hey Simeon,

    I added that code to the ‘Code Snippets’ function PHP section and it did not work. I then tried adding it directly to the function.php file and it still did not work. Obviously I need the first few symbols of inline content script and tried df-shortcode-script without success, so I will pass this on to the dFlip developer and get their feedback.

    Thanks

    • This reply was modified 1 year, 4 months ago by troyw2015.
Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘dFlip Caching Issues’ is closed to new replies.