• Resolved webkocken

    (@webkocken)


    Hi!
    My theme is using dropzone.js for featured images in posts and that won’t work when I have autoptimize activated. Is there a way to solve that somehow?

    If I deactivate the plugin it works like it should.

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

    (@futtta)

    so if I understand correctly dropzone allows you (as admin) to change the featured image of a post, right?

    in that case the solution for visual composer/ beaver builder found in the FAQ should help? alternatively you could try to exclude all JS (files & inline js) dropzone introduces.

    and lastly; always look at your browser console for JS errors, they generally are very helpful in understanding what is (not) happening ??

    frank

    Thread Starter webkocken

    (@webkocken)

    Thanks for a quick reply.

    This is a totally new function that my theme creators released this week.
    It makes it possible to drop an image as a featured image when uploading a recipe front end.

    Is it possible to exclude a certain url?

    Plugin Author Frank Goossens

    (@futtta)

    Is it possible to exclude a certain url?

    it is, cfr. the example code in autoptimize_helper.php_example, but I guess you can change featured image on any post/ page, no?

    so I’d rather go for the “visual page editor”-solution I referred to before (which disables AO for logged in users)?

    Thread Starter webkocken

    (@webkocken)

    Ok, do I add that to my functions.php in that case?

    Plugin Author Frank Goossens

    (@futtta)

    you could, but theme updates will overwrite the change, so better use something like the code snippets plugin?

    Thread Starter webkocken

    (@webkocken)

    Got it working!
    Thanks for the help…=)

    I put it in my child themes function.php

    • This reply was modified 8 years, 3 months ago by webkocken.
    Thread Starter webkocken

    (@webkocken)

    Hi Frank,

    It seems that the code provided messed my open graph codes.
    All of a sudden the scrape info for Facebook isn’t working. If I deactivate the Autoptimize plugin everything is fine again.

    Any ideas why?

    Plugin Author Frank Goossens

    (@futtta)

    that’s not because of the code provided, but because you’re probably have “inline all CSS” or “inline & defer CSS” active, which injects a significant amount of data in the HTML, potentially pushing the opengraph data down too much (facebook only reads part of the HTML’s head if I remember correctly).

    the solution would be to change the place where the inline CSS is injected, using code similar to this;

    add_filter('autoptimize_filter_css_replacetag','webkocken_css_replacetag',10,1);
    function webkocken_css_replacetag($replacetag) {
    	return array("</head>","before");
    	}

    hope this helps,
    frank

    Thread Starter webkocken

    (@webkocken)

    Wow, that got difficult… I guess that code has to be changed somehow?
    Do I put that in my functions.php as well? Or using the code snippet plugin…

    Thread Starter webkocken

    (@webkocken)

    Wonderful, that worked perfectly!

    Thanks for quick response and perfect help!

    Plugin Author Frank Goossens

    (@futtta)

    you’re welcome ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Dropzone’ is closed to new replies.