Support » Plugin: Code Snippets » fresh install – order of elements (shortcode is displayed above other elements)

  • Resolved yurone

    (@yurone)


    hi !

    thanks for providing this plugin !
    it seems like what i need, however i have strange issue…

    i put [shortcode_name] between my html, but it appears above !

    example, i put in html editor:

    111
    [shortcode_name]
    222

    but in front of the site i see in this order:
    [shortcode_name]
    111
    222

    i tried with your shortcodes and tried to create mine… same problem.

    screenshots:
    https://imgur.com/a/U9z8trW

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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

    i tried on another theme and exactly the same problem.
    order of elements is not respected… snippets is first to display

    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

    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 πŸ™‚

    Plugin Author Shea Bunge

    (@bungeshea)

    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();
    } );

    it worked πŸ™‚
    i suppose you need to update plugin now

    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.

    Plugin Author Shea Bunge

    (@bungeshea)

    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘fresh install – order of elements (shortcode is displayed above other elements)’ is closed to new replies.