WordPress Pastebin

This plugin is for you if you like sharing your code. Turn your blog into a pastebin and keep your own code on your own site. You can tag your pastes like you tag your normal posts, and visitors can leave comments if you allow it.

I wrote this because it makes it easier for me to share code. Plus I can easily search my own pastes.

Front end editing of pastes and posting for anonymous users is not enabled by default, and I didn't write a captcha for anonymous posting. Anonymous user's can't tag or categorize their pastes either. Please submit patches if you need such features.

The plugin comes with a widget to list recent pastes.

This plugin was inpired by sivel's pastebin.

Downloads it from WordPress.org.

WordPress plugin demos are disabled as I don't use WordPress on this site any more.

28 comments

  1. avatar
    wrote this comment on

    Sorry if I was sending twice I wasnt sure my question was send...

    Just wanted to thank you and that I run into an issue because I cant select a syntax highlighter in the configuration menu its alsways set to none... In other words I cant select another...

    I'm using the http://www.lastengine.com/syntax-highlighter-wordpress-plugin

    plugin for syntax highlighting maybe thats the reason why?

    kindest regards,
    s!

    1. avatar
      wrote this comment on

      Hello, that page only has 404s for me. My plugin only supports two highlighters at the moment. You can install either of them and use it only for the pastebin, and keep using your current highlighter on your blog. I do that as well.

      1. avatar
        wrote this comment on

        Sorry for the 404s didn't noticed the site seems almost off right now... The highlighter I'm using currently was called: Syntax Highlighter and Code Prettifier Plugin for WordPress

        Thank you for making things clear to me.

        1. avatar
          wrote this comment on

          Hi, you can try version 0.4.5.2, it should support your highlighter plugin.

  2. avatar
    wrote this comment on

    Great plugin, I've been looking for something like this for a while. I'm having an issue with he recent pasts widget though, I've created pasts through the admin and the frontend, but it displays "no recent pastes" any ideas what I could check to get it to work for me?

    1. avatar
      wrote this comment on

      Hmm, I'm not sure but I've just uploaded 0.4.5.3 which might fix your problem.

  3. avatar
    wrote this comment on

    hi there.
    when saving a draft it sys: `Post draft updated. Preview post` I think inside the plugin you should change post to paste, right?

    Also I can't press the publish button, I mean I click it and nothing happens. I msut confess I haven't installed a highlighter yet, would like to know which one you recommend as all recommended ones are pretty old...
    can't you include a free one in your plugin? I'd love to be able to load the highlighter only on pastes not on pages or posts, etc...

    1. avatar
      wrote this comment on

      1. I agree
      2. I can't reproduce
      3. No, I won't include a syntax highlighter. It sounds like you haven't used any syntax highlighter plugin previously? They don't work like you seem to think they work.

  4. avatar
    wrote this comment on

    oh, and after I published it using hte quickedit function because the publish button didn't work, the permalink is broken? see my first test here: http://pacura.ru/category/tech/

    1. avatar
      wrote this comment on

      saving the permalinks again fixed this problem.

  5. avatar
    wrote this comment on

    oh and as a last question: why do you recommend using this plugin instead of simply creating a custom post type called paste, connect it with categories and tags and be done with it?
    whats the difference?

    1. avatar
      wrote this comment on

      That's basically what this plugin does.

  6. avatar
    wrote this comment on

    :-)
    thanks.
    I am currently testing a couple of syntaxhighlighters. switched to my own custom posts though.

  7. avatar
    wrote this comment on

    Code pasted in the pastebin exceeds the limits of the post div.
    I don't see context highlighting, either, but, I can only image, what with the endless possiblities in WP theme coloring, that implementing that would be mindboggling, so that it works with every them, without any text blending into the theme and disappearing.

    1. avatar
      wrote this comment on

      You can force text wrapping with some CSS setting, check my own pastebin for examples. As for the highlighting, did you install a highlighter plugin?

      1. avatar
        wrote this comment on

        Oh! I didn't realize the highlighting was a separate plugin. I do wonder how they can make it work when there's such a variety of theme color, but, I suppose if the pastebin has it's own css elements forcing the white page, it wouldn't be so bad.
        I'll look at the css. The one I want to edit is the one in ../wp-content/plugins/wordpress-pastebin/css/admin.css, yes?

        Oh, et je vous remercie pour votre aide en #wordpress hier. J’ai réussi installer wp et votre plugin (et des autre), dépuis de beaucoup de lutte.

        1. avatar
          wrote this comment on

          No, you should modify the theme's css. Modifications to the plugin css file will be overwritten on the next update!

          De rien!

          1. avatar
            wrote this comment on

            Merci, encore!
            Thanks for clearing that up!

  8. avatar
    wrote this comment on

    I noted, by the way, that it's likely the use of the "pre" tag that your php is generating for the pastebin area, which makes sense, of course, but that is causing text to overrun the borders of the area, since it disables wrap. I'm guessing, but haven't yet tried, that using pre-line or pre-wrap in the css is the solution?
    I considered altering the php script to not use "pre", but, maybe, "code", but I'm not certain if that resolves anything.
    I know...I should try these solutions and then get back to you, perhaps, with my results?
    I was going to mention it in #wordpress last night, but apparently I'm not only without voice, now, but banned (hopefully temporarily).

    1. avatar
      wrote this comment on

      That depends on the highlight plugin you use. My pastebin produces different markup for different plugins.

      See also the white-space CSS option.

      1. avatar
        wrote this comment on

        Yes, the css
        whitespace: pre-line or pre-wrap.
        I looked at that, but haven't taken the time to implement that, yet.