“do_short” not equal to “echo do_shortcode”
-
Just to let you know…
I used
do_short('[preview_template]');
in a (php) page template to preview content to non-logged in users with an url like example.com/preview/?id=1234. The shortcode outputs te code below.[pass global=query fields=id] [if pass='{ID}' empty=false] [loop status=any id='{ID}'] [switch type] [when post][load dir=child file=content-single.php][/when] [when page][load dir=child file=content-page.php][/when] [when fotoalbum][load dir=child file=content-fotoalbum.php][/when] [when sponsor][load dir=child file=content-sponsor.php][/when] [when mededeling][load dir=child file=content-mededeling.php][/when] [when ai1ec_event]<p>Activiteiten previewen is helaas niet mogelijk...</p>[/when] [when default] [load dir=child file=content-single.php] [/when] [/switch] [/loop] [else]<p>Er is hier niets...</p> [/if] [is login]<p><a href="[url site]/wp-admin/post.php?post={ID}&action=edit">Bewerken</a></p>[/is] [/pass]
When the content of the post contains a YouTube URL to embed a video, the video will show up. Also the [gallery]-shortcode and [gravityform]-shortcode do not work as it has to be.
I resolve this with using
echo do_shortcode('[preview_template]');
instead ofdo_short('[preview_template]');
.
- The topic ‘“do_short” not equal to “echo do_shortcode”’ is closed to new replies.