Closed macbruker closed 5 years ago
similar issue, trying to find a way to detect live preview as well. This should be included somehow. For me I'm trying to prevent adsense from being included in live preview which is really against adsense policies (don't shows adsense in frames). With many editors working ad impressions can quickly go in the thousands...
ah okay solved it @macbruker, there already is a way to check. You have to check if $_POST['preview'] isset and is not 1.
In Antlers just like this:
{{ if ! post:preview }}
blah
{{ /if }}
That is awesome! Thank you for sharing your findings 🙂
I have this collapse/expand block on my site. When I am editing with Live Preview, my collapse/expand block is displayed in its default collapsed state, with no possibility to expand it and see the content inside. Clicking to trigger expanding, seems to be prevented in some way.
It would be handy with a variable like
{{ preview }}
or something similar, that returns true if a page is viewed in Live Preview. That way, I can make sure that the collapse/expand block is always expanded when using Live Preview.