WordPress.org

Ready to get started?Download WordPress

Forums

Code Snippets
[resolved] Snippet code disappeared (14 posts)

  1. gedaly
    Member
    Posted 1 year ago #

    Love the plugin!!!

    Since upgrading to 1.6 and WP 3.5, I'm unable to edit the snippet PHP code. I click on a snippet to edit and the edit page loads but the snippet text isn't there. The space just shows up blank and I can't get the cursor to show up.

    http://wordpress.org/extend/plugins/code-snippets/

  2. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. gedaly
    Member
    Posted 1 year ago #

    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.

  4. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. gedaly
    Member
    Posted 1 year ago #

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

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

  6. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  7. gedaly
    Member
    Posted 1 year ago #

    Thanks so much.

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

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

  8. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  9. gedaly
    Member
    Posted 1 year ago #

    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?

  10. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  11. gedaly
    Member
    Posted 1 year ago #

    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.

  12. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  13. Shea Bunge
    Member
    Plugin Author

    Posted 1 year ago #

    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' );
  14. gedaly
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.