• Resolved minhduc.dev

    (@ducpl)


    1. I noticed that when I use exclude jquery from file merge, another file appears that is not merged @@

    2. It’s strange that this gives an “is not defined” error. Although jquery is still loaded first

    https://prntscr.com/26xqvfp

    • This topic was modified 3 years, 1 month ago by minhduc.dev.
Viewing 15 replies - 16 through 30 (of 30 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    it would be inline actually with my previous proposal, but the inline JS would be read from the filesystem and then inlined by PHP, allowing you to keep the inline JS nicely separate from the code snippet ??

    something like (not tested!);

    function ao_js( $content ) {
        $js_code = file_get_contents( <file path> );
        $content = str_replace( "</body>", $js_code . "</body>", $content );
    
        return $content;
    }
    add_filter( 'autoptimize_html_after_minify', 'ao_js', 1 );
    Thread Starter minhduc.dev

    (@ducpl)

    @optimizingmatters
    Wow,
    I will try it when life is fine.
    This method is just now that I know, it was interesting to talk to an expert.
    Thanks for the enthusiastic help for a newbie like me.
    I have learned more from an expert like you.
    Have a nice day brother

    • This reply was modified 3 years, 1 month ago by minhduc.dev.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    a nice day to you as well ducpl ??

    feel free to leave a review of the plugin and support here! ??

    Thread Starter minhduc.dev

    (@ducpl)

    Of course, you deserve the best plugin.
    Thanks for having this plugin

    Thread Starter minhduc.dev

    (@ducpl)

    Sorry, I tried but it didn’t work

    function ao_js( $content ) {
        $js_code = file_get_contents('gtm.txt');
        $content = str_replace( "</body>", $js_code . "</body>", $content );
    
        return $content;
    }
    add_filter( 'autoptimize_html_after_minify', 'ao_js', 1 );
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    try echoing (or error_log-ing) the contents of $js_code, my gut tells me the file cannot be found so the string is empty. you’ll probably need to specify the correct path to where-ever you saved it?

    Thread Starter minhduc.dev

    (@ducpl)

    Ok bro, I’ll try turning on the log

    Thread Starter minhduc.dev

    (@ducpl)

    Oh no,
    Is there any other way bro, because I turned off “allow_url_fopen=0” for security

    “PHP Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0”

    “PHP Warning: file_get_contents(https://domain.com/gtm.txt): failed to open stream: no suitable wrapper could be found in”

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, no need to go over http really; store the file in wp-content/ and then use the WP_CONTENT_DIRconstant to get the path to wp-content dir and add the filename to it and voila? ??

    Thread Starter minhduc.dev

    (@ducpl)

    @optimizingmatters
    Wow awesome, everything works fine.
    Thanks for helping a newbie like me.
    Although I don’t know much, I am always learning and searching.
    Sorry for hiding the name of the website, I’m building a website and don’t want anyone else to see it (except you – you can see it too)
    Thanks expert. Nice to use plugin with your support, I’m a newbie need to learn more php wp

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    enjoy learning, it’s one of the satisfying things a human can do! ??

    Thread Starter minhduc.dev

    (@ducpl)

    Do you mind, sometimes I need a little help. ??
    Thank you, have a nice day

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    no, I don’t mind at all ??

    Thread Starter minhduc.dev

    (@ducpl)

    @optimizingmatters
    Hi expert,
    I’m having a small problem, can I contact you privately?
    I send you coffee, to keep you awake
    Thanks

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    sure, you can use futtta-at-gmail-dot-com ??

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Plugin not properly handling file merge’ is closed to new replies.