WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Snippet code disappeared

[Resolved] Snippet code disappeared

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Shea Bunge
    Participant

    @bungeshea

    I’ll have a look into this. It’s not a problem I’m experiencing. What other plugins (and what theme) are you using?

    I’ve got 2 sites with the same issue. Haven’t checked other sites yet…

    Themes are Canvas and Capital from WooThemes.
    Plugins in common include Akismet, Contact Form 7, Digg Digg, and Yoast’s Google Analytics and SEO plugins.

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    That’s very strange, because I use all of those plugins on my personal site, and Code Snippets is working fine. I’m not using those themes, though. If it’s no imposition, would you be able to post the source code of the page in between the <div class="wrap" opening and closing tags (or the whole page source) either on GitHub or Pastebin or similar? It would make debugging this issue a whole lot easier.

    Errors like this usually occur when two different versions of CodeMirror (which powers the textarea) are loaded on the same page. This wasn’t an issue when Code Snippets used CodeMirror 2 (which is used by many old plugins that use CodeMirror), but version 1.6 and up use CodeMirror 3.

    Sure. Here’s the edit page for a snippet on one site:

    https://gist.github.com/2e1fb7668ba9a7306d24

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    Hmm… it definitely isn’t a problem with the theme, and the other plugins don’t seem to be causing any trouble either. I will have a look into this.

    What internet browser are you using?

    Also, if it’s not too much to ask, could you please post a screenshot showing the snippet editor?

    Thanks.

    Thanks so much.

    I’m on a Mac with Firefox. Same thing happens in Chrome.

    Screenshot: http://www.gedaly.com/snippet-edit-admin.png

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    Can you write code on the Snippets > Add New page? Do the line numbers show up there?

    If you can add a new snippet, can you then edit it?

    Now it’s getting weirder.

    My snippets that have been deactivated for a while I can edit. I can add new ones and edit them. But the ones that have been active all this time can’t be edited whether they’re deactivated or not.

    I’m thinking I should export them, delete them all and then import them again. What do you think?

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    Exporting, deleting, and importing sounds good. If that doesn’t work, you can try exporting, deleting the plugin so data is cleaned up, re-installing the plugin, and then importing the snippets back. It’d be nice if you let me know what works.

    I deleted and re-added. Still having a problem with one snippet. I’m thinking the code isn’t perfect, but I think it’s working still.

    Was the import linked removed in the last update? It’s not showing up for me in the sidebar anymore.

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    The import page has moved under Tools > Import > Code Snippets.

    Having a look at the faulty snippet, perhaps you could try removing the closing (?>) and opening (<?php) PHP tags from your snippet and use echo instead?

    Plugin Author Shea Bunge
    Participant

    @bungeshea

    Assuming the faulty snippet in question is the one displayed in the screenshot and on GitHub, you can try using this code:

    function aweber_single_post() {
    	if ( is_single() ) {
    		echo '<script type="text/javascript" src="http://forms.aweber.com/form/57/1350500557"></script>';
    	}
    }
    
    add_action( 'woo_post_after', 'aweber_single_post' );

    Awesome! I applied that to my other site and snippets, I think that fixed everything. Thanks!!! This is pretty much my new favorite plugin. 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Snippet code disappeared’ is closed to new replies.