• Resolved sarr9121

    (@sarr9121)


    Hi, I’m trying to use autoptimize. My main web page is https://colsalud.com. When applying css optimization the page does not apply any style. I have created a clone of the page to do tests https://clon.colsalud.com and I discovered when reviewing the source code of the page that all code minimized by optimize corresponding to the css appears inside comment html (<- – ->), for that reason does not load any style. Could you help me figure out why this happens? First I thought it was wp super cache; Disable it and continue the error; Then I thought it was the security plugin, disable wordfence and continue the error.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Frank Goossens

    (@futtta)

    hi @sarr9121;
    on clon.colsasud.com you seem to be using something to defer CSS loading which seems to be somehow breaking Autoptimize’s optimization. can you disable that so I can see what AO does?

    frank

    Thread Starter sarr9121

    (@sarr9121)

    Hi Frank. thanks for your prompt response. I have disabled the css defer plugin on the clone site. I’m using the in line css option. And the page does not load the css. Everything appears as html comment.

    Santiago.

    Plugin Author Frank Goossens

    (@futtta)

    this is (normally) not something AO does, looks like a plugin conflict. can you selectively disable other plugins (and briefly switch themes) to identify the culprit?

    fran

    Thread Starter sarr9121

    (@sarr9121)

    Hello Frank, apparently it is something related to the theme, I have changed to the typical themes of wordpress and the plugin works. I know it’s not your theme, but you have an idea that could cause this block?

    Thanks.

    Santiago.

    Plugin Author Frank Goossens

    (@futtta)

    not really, should see the code … is this a theme on https://wordpress.org/themes ?

    Thread Starter sarr9121

    (@sarr9121)

    Not, is a theme from themeforest.
    https://themeforest.net/item/health-plus-health-clinic-wordpress-theme/12244953

    i wrote to the support page, but i still waiting for some answer.

    Plugin Author Frank Goossens

    (@futtta)

    well, as all theme’s (and plugins) are GPL you are allowed to share the code, so … πŸ™‚

    Thread Starter sarr9121

    (@sarr9121)

    ok i dont have problem with that. but how share you the code? all the folder have about 18 MB. or what file you need to see?

    Plugin Author Frank Goossens

    (@futtta)

    zip the folder, upload it somewhere and send me the link via mail (futtta-at-gmail-dot-com)?

    Thread Starter sarr9121

    (@sarr9121)

    Hi frank, sorry for the delay in sending, but I had to leave outside, and only so far I could return. I share you the compressed folder via mail. Any help you can give me will thank you.

    Plugin Author Frank Goossens

    (@futtta)

    no problem πŸ™‚

    so the problem is that healthplus outputs this;

    <!-- <title></title>-->
    		<title>futtta's local testblog – Just another WordPress site</title>

    and that autoptimize injects the optimized CSS in front of the (first) title-tag it finds, which due to the healthplus code is inside the HTML-remark’ed block.

    root cause fix would be for the theme dev to remove that unneeded HTML comment block.

    workaround fix is to tell AO to inject the optimized CSS elsewhere using a coupld of lines of code against AO’s API, e.g.;

    
    add_filter('autoptimize_filter_css_replacetag','fix_healthplus_css');
    function fix_healthplus_css() {
      return array("<!-- <title>","before");
    }

    (do take into account that this will only work as long as healthplus has the comment-block there, it might be safer to inject elsewhere after all)

    frank

    Thread Starter sarr9121

    (@sarr9121)

    Bravoooooo, you are a Master.

    Thankyou very much for your help.
    Now I have to test the plugin to improve the loading times of the page. Above all, try the inline and defer function, thanks again.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Css optimized appears inside comment html and dont render’ is closed to new replies.