Thread Starter
yurone
(@yurone)
i use this theme and i tested both in Pages and Posts mode.
https://www.elegantthemes.com/gallery/extra/
if you want to try it here is download
https://www.sendspace.com/file/89ubbb
p.s. i emptied cache but didn’t help
Thread Starter
yurone
(@yurone)
i tried on another theme and exactly the same problem.
order of elements is not respected… snippets is first to display
Thread Starter
yurone
(@yurone)
in the screenshots i provided above i made tests with default sample snippets.
when i test with my snippets shortcodes (they display image + onclick action)
also i noticed that in the “admin” edit of this page i see my images on top of EDITOR which is obviously also a bug.
https://nimb.ws/tv8Jo6
Thread Starter
yurone
(@yurone)
i tried another plugin on same environment and it worked fine.
i use WordPress 5.0.3–en_US au
let me know when you fix it and i will tray again 🙂
Hi yurone,
Thank you for reporting this. It looks like there’s a bit of an issue with my example shortcode snippet. Shortcode callbacks should not echo content, but should always return it.
Here’s one example of how you could fix that snippet:
add_shortcode( 'shortcode_name', function () {
return '<p>write your HTML shortcode content here</p>';
} );
Otherwise, if you would prefer to write direct HTML code and not have to worry about PHP strings, you can use output buffering like this:
add_shortcode( 'shortcode_name', function () {
ob_start(); ?>
<p>write your HTML shortcode content here</p>
<?php
return ob_get_clean();
} );
Thread Starter
yurone
(@yurone)
it worked 🙂
i suppose you need to update plugin now
Thread Starter
yurone
(@yurone)
thx, cool plugin and fast support
Hi @bungeshea,
Was this fixed in the most recent release of Code Snippets, which came out after this thread was posted?
Doesn’t look like it, but wanted to be double-check or see why not.
Thanks for a great plugin!
It looks like this issue was also touched upon a couple years ago here:
https://wordpress.org/support/topic/snippetshortcode-moves-on-content-page/#post-9040038
So, a bit puzzled.
Thanks again.
Hi @roam92,
The issue is one that should be fixed in individual sites, not in the plugin itself. Updates to the plugin only fixes the default sample snippets which are installed on new sites.