Code Snippet

First off, Code Snippet 2.0 is not mine. I didn’t make it, I won’t take any credit for it. The original creator was the person who hosted a blog at http://blog.enargi.com/codesnippet/ (which no longer works and is apparently down for good; however, it is GPL.). I came across the plugin awhile ago and and I’ve decided that I couldn’t just let it be lost to the ages and I’ll let it live here as long as I’m able.

Straight from the readme.txt, Code Snippet 2.0 is is a WordPress plugin for displaying code with highlighting in blog posts. The plugin uses GeSHi syntax highlighter engine. I’ve seen others, but they’ve gone the way of the dodo and most of them didn’t have as many supported languages at Code Snippet 2.0. I also think that Code Snippet does a better job than the Code Auto-escape plugin.

Install

  • Download the plugin here. Or potentially, an older version from here.
  • Copy archive to wp-content/plugins directory
  • Extract the zip file
  • When extracted properly you should have following directory structure: /wp-content/plugins/codesnippet
  • Since I’ve not tore through the code, the plugin will probably not work if extracted/copied in diffrenet directory.
  • Enable the Plugin

Usage
The original author recommended always wrapping your code in a <pre> tag; however, I’ve found that you generally don’t need to. To use it, simply surround your code with as such and specify your language type:

[code lang="c"]
int main(int argc, char** argv) { return 0; }
[/code]

And you get this:

int main(int argc, char** argv) { return 0; }

Or you could do something like:

[code lang="php"]
<?php
echo “Hello World!”;
?>
[/code]
<?php
     echo "Hello World!";
?>

If you find a bug in it, drop a comment or an email to wyatt dot neal at gmail and I’ll try my best to fix it for you.

Also, if you have find that your language isn’t here and you write your own GeSHi hack to work with it, let me know and I’ll drop a link on this page so that people can find you. Heck, I’ll even put it in the archive so the world can share it if you want. Here’s the list of supported languages:

Collapse Language List

  • actionscript-french
  • actionscript
  • ada
  • apache
  • applescript
  • asm
  • asp
  • bash
  • caddcl
  • cadlisp
  • c_mac
  • c
  • cpp
  • csharp
  • css-gen
  • css
  • delphi
  • diff
  • div
  • dos
  • d
  • eiffel
  • freebasic
  • gml
  • html4strict
  • ini
  • inno
  • java
  • javascript
  • lisp
  • lua
  • matlab
  • mpasm
  • nsis
  • objc
  • oobas
  • oracle8
  • pascal
  • perl
  • php-brief
  • php
  • python
  • qbasic
  • sdlbasic
  • smarty
  • sql
  • vbnet
  • vb
  • vhdl
  • visualfoxpro
  • xml
  • and many more!!!

Trackback URL.

133 Comments

  1. Jeremy Lavergne says:

    I’ve not looked yet, but does this plugin just use the highlight files from VI or the likes? It would seem that it’d be easily updated then by adding new files from VI or what have you.

  2. Wyatt says:

    I’m not really sure, Jeremy. Looking at the code it appears that it’s really just an assembly of everyone else’s GeSHi PHP translators with some tweaked wrapping to make it work correctly in WordPress. I just can’t remember if VI uses the GeSHi stuff or not.

  3. JR says:

    You should mention adding the codesnippet/codesnippet.css link to the header and defining the codesnip-container class in the installation instructions.

  4. Wyatt says:

    The following has been added to the readme.txt thanks to JR:

    After looking more carefully at the code, I see that it adds the following action to wp_head:

    function addCssStyle() {
         echo ‘<link rel="stylesheet" href="’.get_option(‘siteurl’).$this->pluginLocation.‘/codesnippet.css" type="text/css" />’, "\n";
         echo ‘<style type="text/css">’, "\n";
         echo ‘.codesnip-container  {‘.$this->getStyle().‘}’, "\n";
         echo ‘</style>’, "\n";
    }

    That automatically adds a link to the provided css file and a separate style for the codesnip container (as defined in the plugin config, I would assume). I don’t use wp_head in my custom theme, so that’s why it didn’t link to it automatically. You might want to include a small note for custom theme users to link to the css and define a style for codesnip-container.

    Details are in the readme.txt. Thanks again JR.

  5. Bladimir Favio Yapura - Blog » Blog Archive » Nuevo PlugIn says:

    [...] PlugIn 0 Comments Acabo de instalar un nuevo plugin para mi blog, se trata de Code Snippet, para que sirve?? para escribir esto por [...]

  6. takn says:

    thanks for keeping this great plugin alive.

  7. Løb og fiks PHP! | Mattias’ virtuelle hukommelse says:

    [...] Bemærk i øvrigt lige det super seje plugin jeg har installeret, der sørger for at farve PHP-koden efter bedste principper Plugin’et kan for de interesserede downloades herfra: http://blog.hackerforhire.org/2007/03/16/code-snippet-20/ [...]

  8. Lustiges Computieren » Blog Archive » Codeschnipsel says:

    [...] verwendet. Leider gibt’s die Seite des Authors nicht mehr, wobei sich dieser nette Herr freundlicherweise der Pflege des auf GPL basierenden Codes angenommen [...]

  9. Eric and Jessica » Blog Archive » Small fixes says:

    [...] and to get those fancy code blocks to show up I installed the Code Snippet 2.0 plug-in and disabled my WYSIWYG editor. We’ll see how that [...]

  10. gad says:

    thx for this wonderful plugin.

  11. The Historical Webber » Blog Archive » How does the yahoo/flash map work… says:

    [...] thanks to CodeSnippet for providing a way to show code. This was the 5th one I tried that finally [...]

  12. Bernie SR says:

    Would this plugin dispaly the code in my posts , I have inadvertently added some code from a widget to my blog. Every time that I post the widget is enbedded in each message. Obviuosly I want to renmove the offending code

  13. Wyatt says:

    Bernie, I don’t think that it would do this; however, I’m not very familiar with the new WP-widget system. This plugin should only display code that you have wrapped in a code block.

  14. John says:

    Great plugin. This saves a lot of time.

    Im having trouble displaying the line numbers. I checked the option and it displays a grey bullet point in front of each line. Any tips?

  15. John says:

    No worries now. It seems that my themes CSS was overiding the list style.

  16. Wyatt says:

    Glad to heard that you got it fixed before I had a chance to look at it John.

  17. In a galaxy far far away… » Blog Archive » Enargi Code Snippet Plugin says:

    [...] was able to download the plugin here after finding the original host was [...]

  18. Lexxy`s Blog » Blog Archive » Code Snippet says:

    [...] hier Code Snippet [...]

  19. The Double Zero » Blog Archive » Codesnippet and firestats incompatability - finale says:

    [...] Go grab the code snippet plugin and if you like codesnippet copy this image, put it on your sidebar and show your appreciation! [...]

  20. מחשבות, מחשבים, ושאר דברי בלע » Blog Archive » CodeSnippet says:

    [...] לי לגלות פלאגינים מעניינים ושימושיים. פלאגין כזה הוא Code-Snippet 2.0, שמאפשר שתילת קוד בפוסטים וצביעה שלהם בהתאם, ממש כמו [...]

  21. seramar says:

    Hey recently I posted a snippet in a post and after a reader tried to paste the code into their blog I found a new problem -

    The codesnippet plugin converts ” ” to curly quotes… and therefore are not always/universally recognized by web browsers or processed correctly.

    To view the specific example: http://www.thedoublezero.org/comment-exchange-movement

    When a reader tried pasting it into their sidebar it wouldn’t work. I asked about their theme and tried it out and found the problem to be the quotes. Any idea on how to override this OR to fix it permanantly?

    Thanks, man – so far your responsiveness has been great!

    Seramar

  22. seramar says:

    found the fix… it appears that the offense is contained to lang=”html4strict”

    To fix it go to the html4strict.php file contained in wp-content/plugins/codesnippet/lib/geshi/html3strict.php

    Line 57 will read:

    ‘QUOTEMARKS’ =&gt; array("’", ‘"’),

    Delete everything between the parenthesis so it looks like

    ‘QUOTEMARKS’ =&gt; array(),

    Should fix your issues.

    Thanks anyway – glad if I was of any help!

  23. seramar says:

    bah! That is kinda messed up… codesnippet didn’t work right, but anyway you should get the idea. I will also submit the fix to the GeSHi folks and hope they take care of it.

    -Seramar

  24. Wyatt says:

    Alright everyone, I’ve tagged out a 2.1 version of CodeSnippet, which is the download link on this page. I’m going to be upgrading the GeSHi to the latest and greatest as well as adding in some new functionality.

    This is going to be living at http://blog.hackerforhire.org/code-snippet/ from now on and I’m probably not going to be monitoring this post :-)

    Thanks for all the feedback!

  25. Wyatt says:

    I’m testing out the newest version to see how the new languages will work. Looks good to me :-)

    Ruby test

    # The Greeter class
    class Greeter
    def initialize(name)
    @name = name.capitalize
    end

    def salute
    puts "Hello #{@name}!"
    end
    end

    # Create a new object
    g = Greeter.new("world")

    # Output "Hello World!"
    g.salute

  26. Jason says:

    function addCssStyle() {
         echo ‘pluginLocation.‘/codesnippet.css" type="text/css" /&gt;’, “\n“;
         echo ‘’, “\n“;
         echo ‘.codesnip-container  {’.$this-&gt;getStyle().‘}’, “\n“;
         echo ‘’, “\n“;
    }
  27. Wyatt says:

    Yeah, sorry Jason. Line numbers and file-reading aren’t in the code yet. I have to find a good way to secure it so someone couldn’t say file=”wp-config.php” lines=”1-20″

    It’s coming, I promise :-)

  28. Sin Ideas » Internet Explorer y max-height says:

    [...] aqui, todo culpa de IE y [sarcasmo]su grandioso soporte de los estándares[/sarcasmo]. Al poner el plugin para resaltar la sintaxis del código que escriba, quize que si el código era muy grande lo [...]

  29. Wyatt says:

    Alright, comments on this post are closed. From now on, use the main-page for this.

    http://blog.hackerforhire.org/code-snippet/

  30. Chronicles of the Hidden Truth » Installing Code Snippet 2.0 plugin says:

    [...] As I expect to be able to publish some articles with source code, I was wondering about the availability of Worpress plugins dealing with syntax highlighting. Fortunately I was not alone on that, and I download this nice plugin CodeSnippet [...]

  31. Mike Saeger says:

    I can’t get this VB code to display properly:

    If Request.QueryString(“mi”) “” Then
    ddmi.SelectedIndex = ddmi.Items.IndexOf(ddmi.Items.FindByValue(mi))
    btnSearchClick() ‘
    End If

    The (less than) and (greater than) signs always show up as < and > instead of the actual symbols.

  32. Mike Saeger says:

    My previous comment is confusing. What I should have said is that the (greater than) sign shows up as (ampersand gt ;) and the (less than ) sign shows up as (ampersand lt;)

  33. Wyatt says:

    If Request.QueryString("mi") <> "" Then
         ddmi.SelectedIndex = ddmi.Items.IndexOf(ddmi.Items.FindByValue(mi))
         btnSearchClick()
    End If

    Looks like it works to me. Remember to wrap your code with the [ code ] block (minus the spaces).

    Now I will admit that if you copy and past this, it’s probably going to give you some weird “quote” signs because of how the GeSHi engine works. If you have a complaint about that, you’ll need to take it up with them :-)

  34. Natrium says:

    I just had the same problem with > and into >
    And the codesnippet-plugin doesn’t seem to recognize the >

    Solution: use the code-editor in stead of the visual-editor of WordPress.

  35. Natrium says:

    second try :-)

    I just had the same problem with > and into &gt;
    And the codesnippet-plugin doesn’t seem to recognize the &gt;

    Solution: use the code-editor in stead of the visual-editor of WordPress.

  36. Mike Saeger says:

    I even turned off the Visual Editor in my Profile and as soon as I hit SAVE, or SAVE and Continue the < > signs disappear. It must be in the version of WordPressMU I’m running (wordpress-mu-1.1.1). If I use the Visual Editor then the < > are replaced by their ampersand lt/gt semicolon html names.

  37. Wyatt says:

    Natrium makes a very valid point. I never used the Advanced/Visual editors to write code blocks, generally because they caused more headache than anything.

    Mike, are you sure you are wrapping things in the
    [code lang="vb"][/code] tags? If you aren’t, I know even the raw/standard editor in WordPress will remove <>. I think that it looks like an unclosed tag to WordPress.

    I’ll see what I can do to get &gt and &lt found in the parsing.

  38. Crusty Blog » Blog Archive » Test GeSHi says:

    [...] a couple different syntax highlighters for WordPress. The one I’ve settled on is CodeSnippet. This plugin allows syntax highlighting by using code blocks. [...]

  39. Pets Information Directory » Eulogy pet says:

    [...] eulogy pet footer sore for you reassurance sturdy couchs. Some of you are within useing what the eulogy pet is intelligent [...]

  40. ctcodre’s blog » Blog Archive » code snippet says:

    [...] tag-ului . ceea ce am gasit astazi este un plugin care face cam aceleasi lucruri. look here for Code Snippet. Si un mic test sa vedem daca merge: [code lang=”java”] public class HelloWorld { [...]

  41. MB.MathemaTeX » Archive du blog » Code Snippet says:

    [...] Site officiel : http://blog.hackerforhire.org/code-snippet/ [...]

  42. MacScripter: Introduction to Database Events at The Joy of Scripting says:

    [...] 27.10.2007: Or just have a look at the library code right here: (Test of the Code Snippet plugin for [...]

  43. Banan says:

    If someone will have trouble with bash language, just download the original geshi.php file form http://qbnz.com/highlighter/ and replace it with the one in the code snippet package. It work’s fine for me :)

  44. Wyatt says:

    Testing update to the GeSHi stuff. This fixes the bash issue referenced above.

    #!/bin/bash

    echo "This is a terrible test example";

    FILE=`which yes`;

    for i in `seq 1 91`; do echo $i | $FILE; done

  45. Rob’s geeky discoveries Blog » Flash getURL clickthrough workaround for MySpace says:

    [...] You’ll have to manually swap those curly brackets for standard double quotes as Code Snippet doesn’t like this [...]

  46. Create Digital Media » phpBB to bbPress Migration Process - Step 1, Remove Spam Users says:

    [...] aside: The lovely code highlighting in this post was provided with the Code Snippet WordPress plugin, which I installed because WP was misinterpreting my [...]

  47. muttznutz says:

    Hi,
    Excellent plugin, and thanks for keeping it running.
    I think I’ve found a bit of an “undocumented feature”.
    My problem was that putting code into comments didn’t load the .css file.
    I’m not a php wizz, but I think it may be because of the pageHasCode test in codePresentInPosts().
    So if there’s no code in the original post, CodeSnippet won’t detect it in the related comments.
    Nothing I can’t work around, but it would be useful if you could confirm.

    Thanks — Andy

  48. Wyatt says:

    Hi Andy,

    You’re right, CodeSnippet will not highlight code in comments if there isn’t a previous [code] block in the post. I don't have a quick workaround for this other than putting in a blank [code] block for people that don't want to touch the code; however, that looks absolutely stupid. I'm not sure what impact pushing everything through the filter; however, I'll take a look at it.

  49. Wyatt says:

    Rob mentioned he was having an issue with the following block of code. It seems to be a problem with the GeSHi ‘html’ parser. My recommendation is to use the ‘php’ one instead as it seems to catch the flakeyness.

    HTML Version:

    <style type=text/css”> table.adiflmw { width: 396px; height: 250px; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: none none none none; border-color: white white white white; background-color: white; } table.adiflmw td { border-width: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; border-style: none none none none; border-color: white white white white; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } a:link, a:active, a:visited { color:#ffffff; } </style> <table class=”adiflmw”> <tr> <td valign=”top” align=”left”> <span> <a href=”http://adidaswidgets.glueserv.co.uk/v9/id=”adiCt1″ rel="nofollow"><img src=”http://adidaswidgets.glueserv.co.uk/v9/adiflm396×38.jpg” border = “none” /></a><br /><object type=”application/x-shockwave-flash” allowScriptAccess=”never” allowNetworking=”internal” height=130 name=width=396align=”middle” data=”http://adidaswidgets.glueserv.co.uk/v9/Clock02.swf?spURL=http://http://www.justgiving.com/gorillarob&getCountDownLink=http://adidaswidgets.glueserv.co.uk/v9/”> <param name=”allowScriptAccess” value=”never” /> <param name=”allowNetworking” value=”internal” /> <param name=”movie” value=”http://adidaswidgets.glueserv.co.uk/v9/Clock02.swf?spURL=http://http://www.justgiving.com/gorillarob&getCountDownLink=http://adidaswidgets.glueserv.co.uk/v9//> <param name=”quality” value=”high” /> <param name=”wmode” value=”opaque” /> <param name=bgcolorvalue=”#ffffff” /> </object> <br /> <a href=”http://http://www.justgiving.com/gorillarob” id=”adiCt2″ rel="nofollow"><img src=”http://adidaswidgets.glueserv.co.uk/v9/adiflm396×82.jpg” border = “none” /></a> </span> </td> </tr> </table>

    PHP Version with some cleanups:

    <style type="text/css">
    table.adiflmw { width: 396px; height: 250px; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: none none none none; border-color: white white white white; background-color: white; }
    table.adiflmw td { border-width: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; border-style: none none none none; border-color: white white white white; background-color: white; -moz-border-radius: 0px 0px 0px 0px; }
    a:link, a:active, a:visited { color:#ffffff; }
    </style>
    <table class="adiflmw">
    <tr>
    <td valign="top" align="left">
    <span>
    <a href="http://adidaswidgets.glueserv.co.uk/v9/&quot; id="adiCt1" rel="nofollow"><img src="http://adidaswidgets.glueserv.co.uk/v9/adiflm396x38.jpg&quot; border="none" /></a><br />
    <object type="application/x-shockwave-flash" allowScriptAccess="never" allowNetworking="internal" height="130 name=" width="396" align="middle" data="http://adidaswidgets.glueserv.co.uk/v9/Clock02.swf?spURL=http://www.justgiving.com/gorillarob&getCountDownLink=http://adidaswidgets.glueserv.co.uk/v9/&quot;>
    <param name="allowScriptAccess" value="never" />
    <param name="allowNetworking" value="internal" />
    <param name="movie" value="http://adidaswidgets.glueserv.co.uk/v9/Clock02.swf?spURL=http://www.justgiving.com/gorillarob&getCountDownLink=http://adidaswidgets.glueserv.co.uk/v9/&quot; />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="bgcolor" value="#ffffff" />
    </object>
    <br />
    <a href="http://www.justgiving.com/gorillarob&quot; id="adiCt2" rel="nofollow"><img src="http://adidaswidgets.glueserv.co.uk/v9/adiflm396x82.jpg&quot; border = "none" /></a></span>
    </td>
    </tr>
    </table>

    I think it has to do with the weird characters that are being used … probably a GeSHi bug since the regex is matching it on my end.

  50. DenkZEIT » Blog Archive » Neues Wordpress-plugin installiert: CodeHighlighter says:

    [...] CodeHighlighter bin ich fndig geworden. Alternativ hatte ich mir noch Code Snippet angesehen. Letzteres war mir aber zu Astronautisch mit Zeug, das ich nicht brauche. Z.B. einer [...]

  51. 智熏 says:

    [code lang="php"[

    [/code]
    :)

  52. 智熏 says:

    oops -.-;;

  53. Wyatt says:

    That’s why I added in a preview for this beast :-P

  54. jutirain says:

    Thanks for the great plugin!

    However, does the plugin provide indenting feature?
    Also, I found that the plugin doesn’t work for php…

    The code inside [?php & ?] will be eat up by wordpress. (using brackets deliberately to prevent php being eaten)

    P.S. I’m using wordpress 2.0.2

  55. Wyatt says:

    @jutirain

    > However, does the plugin provide indenting feature?

    Unfortunately, it does not. I have the plan to read from a file on
    the back burner, but it hasn’t been implemented in anything less than
    my local SVN copy.


    > Also, I found that the plugin doesn’t work for php…
    > The code inside [?php & ?] will be eat up by wordpress. (using brackets
    > deliberately to prevent php being eaten)

    <?php

    echo "this is a PHP test.";

    $tmp = array();
    for ($i = 0; $i < 25; $i++) {
        $tmp["myspot" . $i] = $i;
    }
    ?>

    #test some invalid php code
    <?php
    [?php & ?] ; //this should be invalid php code
    //intentionally don’t close the bracket

    Looks like it works here and I haven’t noticed any issues with
    wordpress 2.0.2, but I’d recommend upgrading just for the security
    fixes.

  56. Code Snippet_Wordpress plugin says:

    [...] I’m attempting to keep his wonderful contribution available so I’ve given it a home at http://blog.hackerforhire.org/code-snippet/. If you find any bugs with it, let me know and I will do my best to resovle [...]

  57. TechnoTinkering » Blog Archive » Finally, close but not perfect says:

    [...] http://blog.hackerforhire.org/code-snippet/ [...]

  58. Wp Wordpress » Blog Archive » Code Snippet says:

    [...] I’m attempting to keep his wonderful contribution available so I’ve given it a home at http://blog.hackerforhire.org/code-snippet/. If you find any bugs with it, let me know and I will do my best to resovle [...]

  59. Lee says:

    I also have the same issue jutirain has. WP eats the code.

  60. Wyatt says:

    <?php

    function foo($bar) {
        $i = 0;
        for($i = 0; $i < count($bar); $i++) {
            print($bar[$i]);
        }
    }
    ?>

    [code lang="php"]
    <?php

    function foo($bar) {
       $i = 0;
       for($i = 0; $i < count($bar); $i++) {
           print($bar[$i]);
       }
    }
    ?>
    [/code ] minus the space so it will print out properly

  61. chaozz@work » Blog Archive » My flatfile database system (3) says:

    [...] snippets in this WordPress post I use a plugin called CodeSnippet, which can be downloaded here: http://blog.hackerforhire.org/code-snippet/ Category: Development  |  Comment (RSS) [...]

  62. Team Programming Dragon.編程龍 » Blog Archive » WordPress Plugin for Code Display says:

    [...] 當中的 display,應該是目前看過 plugin 數最多的一個需求了,諸如 Code Markup, Code Snippet, CodeHighlight, iG: Syntax Hiliter, Preserve Code Formatting [...]

  63. Ciekawe pluginy do Wordpressa | Spam Factory says:

    [...] Code snippet - plugin do wyświetlania kodu (np. php – można zdefiniować w jakim języku kod wklejamy) na naszym blogu. Poniżej przykład z php if(isset($_GET[‘c’])) {$c = $_GET[‘c’]; if($userInfo = checkValidationCode($c)){ /*Check validation code*/ $email = $userInfo[‘user_email’]; } else $error = “The verification code is not valid.”; } else $error = “The verification code is not valid.”; [...]

  64. Pixelsetzer » » Code Snippet Plugin says:

    [...] hinzufügen. Wer das Plugin haben möchte, kann mal die Seite des Herstellers besuchen: klick Da ich selber erst seit kurzen mit WordPress arbeite, werde wohl noch mehr Artikel zum Thema [...]

  65. harbrigging says:

    Someone submit this to programminghelp.com forum site please! Thanks!!!

  66. Afficher du code dans WordPress via une extension - Blue Cosmos Team Blog says:

    [...] conséquent, j’ai trouvé ici une extension qui gère plus de 50 langages de programmation. Pour l’utiliser il suffit [...]

  67. Perseverance Trumps Talent » Blog Archive » Testing out Code Snippet 2.0 says:

    [...] The folks over at Hacker for Hire have a great plugin for WordPress called Code Snippet 2.0. [...]

  68. jutirain says:

    The same issue with Mike..

    The will be be the ampersand lt/gt semicolon. I’m sure I’ve include the

    GeSHi Error: GeSHi could not find the language xx (using path /home/wyatt/public_html/blog.hackerforhire.org//wp-content/plugins/codesnippet/lib/geshi/) (code 2)

    properly since the syntax highlighting works.

  69. jutirain says:

    Sorry for the mistake in last post.

    The same issue with Mike..

    The will be be the ampersand lt/gt semicolon. I’m sure I’ve include the [code][\code] properly since the syntax highlighting works.

  70. Wyatt says:

    The problem seems to be with the rich-text editor in WordPress. Unfortunately, I don’t know enough about the internals of the rich-text editor to patch the code to handle it. My only recommendation is to use the basic editor for now. I’ll see what I can do to fix it, but I think trying to keep up with WordPress’s changes to their rich-editor is probably going to be more involved. Again, the applicable test:

    If Request.QueryString("mi") <> "" Then
         ddmi.SelectedIndex = ddmi.Items.IndexOf(ddmi.Items.FindByValue(mi))
         btnSearchClick()
    End If
  71. Aktuelle Plugin-Liste at IT-Serie says:

    [...] Code Snippetzum Formatieren von Quelltext, mit farblicher Darstellung (Syntax highlighting), kennt sehr viele Programmiersprachen, nummeriert Zeilen wahlweise automatisch [...]

  72. ray says:

    DECLARE @a nvarchar(max)
    SET @a = ‘abc’
  73. www.jclaudius.net/blog » How to Upgrade to Ubuntu 8.04 LTS (Hardy) via Command Line says:

    [...] – This is my first time using code-snippet and I love it.  Props to hackerforhire.org for reviving such a useful [...]

  74. Pixelsetzer » » Praktische Wordpress PlugIns, die ich selber benutze says:

    [...] Code Snippet ist für alle praktisch und sinnvoll, die Code veröffentlichen wollen. Dabei spielt es keine Rolle, ob es sich um PHP, JAVA, C oder eine andere Programmiersprache handelt, den es gibt schon jede Menge implementierte Layouts für viele verbreitete Script und Programmiersprachen. [...]

  75. Pixelbath » Blog Archive » GeSHi JSFL Language File says:

    [...] last post about JSFL caused me to look for a nice syntax highlighting plugin. I found the excellent Code Snippet plugin that uses GeSHi (Generic Syntax Highlighter) for its highlighting engine. Since there seems [...]

  76. andra says:

    thank’s man for this plugin, i like it.

  77. 12 Wordpress Plugins to Display and Highlight Code within your Blog : Speckyboy Design Magazine says:

    [...] Code Snippet WP Plugin [...]

  78. Code Snippet Plugin | WordPress Plugins Database - WordPressPluginsDatabase.com says:

    [...] I’m attempting to keep his wonderful contribution available so I’ve given it a home at http://blog.hackerforhire.org/code-snippet/. If you find any bugs with it, let me know and I will do my best to resovle [...]

  79. kiko says:

    beautiful blog merciiiii

  80. Paulo Lima says:

    Hi,

    The download link is broken, 404 file not found. =/

  81. Wyatt says:

    Sorry about that. It’s broken from me moving to a new server. The link should be good now. If not, let me know.

  82. Ana Flávia says:

    Hi,
    The plugin doesn’t work in WP 2.8.1 “/

  83. Wyatt says:

    Just upgraded this site to WP 2.8.1 and it appears to be working. I did have an issue with the redirection plugin though. If you can provide me more details on what you’re having a problem with, I’d be happy to try and fix it.

  84. Ana Flavia says:

    Hi Wyatt.
    My problem is in the panel of control. After I updated for WP 2.8.1, the panel of control shows a message saying that I have not sufficient permissions to access the page. In my blog it works correctly, but I only would like to change the CSS. Here the print of the page when I try to access: http://i28.tinypic.com/slqpeq.jpg
    Thank you very much! ^^

  85. Wyatt says:

    Hmm, it appears to be a bug with the way that WordPress is accessing the plugin configuration pages. I’ll see what I can do to fix that.

  86. Ana Flavia says:

    The plugin works perfectly now!
    Thanks ^^

  87. Biia says:

    Hi Wyatt.
    My WP is 2.8.1, the panel of control shows a message saying that I have not sufficient permissions to access the page. I want to change the CSS. Here the print of the page when I try to access: http://i158.photobucket.com/albums/t94/bia-chan05/print.png
    Thanks!

  88. Biia says:

    Hi Wyatt.
    My WP is 2.8.2, the panel of control shows a message saying that I have not sufficient permissions to access the page. I want to change the CSS. Here the print of the page when I try to access: http://i158.photobucket.com/albums/t94/bia-chan05/print.png
    Thanks!

  89. Wyatt says:

    I’ll take a look at it tonight. Blackhat and Defcon aren’t quite the friendliest networks in the world and AT&T had horrible 3g service while I was out there.

  90. Wyatt says:

    Biia,

    I’ve updated the plugin. The current release on the WP should be 2.1.5 which should address you issue. The previous versions of 2.1.x should work correctly; however, they didn’t have the version number updated to reflect the actual version installed so attempting to update these through WP would probably fail. If you need a direct link, try this: http://downloads.wordpress.org/plugin/codesnippet-20.2.1.5.zip

  91. Wyatt says:

    Biia, you might want to give that link a few. Looks like the WP extend site is taking longer to update than normal.

  92. Biia says:

    Hi Wyatt,
    I update my WP for the new version 2.8.3
    Now it’s working perfectly!
    Sorry for the duplicated comment =D
    Thanks!

  93. Kare says:

    Hi, and thanks for an excellent plug-in.
    But when I tried to install it from within WordPress 2.8.3 it didn’t activate or show up in the plugins list and when trying to install it again it told me that it was already installed. It had installed a folder called “codesnippet-20″ containing another folder called “codesnippet” in the plugins folder. When I removed those folders, downloaded the zip file directly and copied the “codesnippet” (not “codesnippet-20″) folder into the plug-ins folder of WordPress it worked perfectly. Maybe there is some bug in the installation procedure?

  94. Wyatt says:

    Make sure you download the 2.1.5 version from WordPress.org. I’ve not had any issues with this version.

  95. kevin says:

    Great plug-in. I will try it

    Many Thanks

  96. Karsten says:

    Hi,
    The plugin works nicely, thanks. Is there an easy way to insert tabs, so the code in formatted nicely?
    TIA

  97. Wyatt says:

    I’ve toyed with the idea of inserting tabs/spaces into the code; however, the GeSHi engine only does highlighting and not code-formatting or beautification. I’ve found that if you copy and paste your code, with tabs and spaces, it seems to lay out in the same fashion on the screen. If that’s not working, let me know and I’ll get on fixing it :)

  98. Josh says:

    I’ve got this up and running and it seems to be working great so thanks for keeping this thing alive. I would also be interested in the ability to indent code etc. I’ve tried copying preformatted code but it doesn’t maintain it once I paste it into the post.

    thanks agai.

  99. Hire Personnel says:

    thanks for sharing this plug in.now i can solve my problem.

  100. ppat says:

    Hi! I’ve WP 2.8.4 and codesnippet doesn’t work. Even when I move plugins/codesnippet-20/codesnippet/ to plugins/codesnippet/ I can’t see any entry in “Manage Plugins” option in the administrative interface.
    Neither the posts show higlighted code.

  101. Wyatt says:

    I’ve not upgraded to WP 2.8.4 yet; however, I will do it this weekend and see if I can figure out what the problem is. Code snippet should exist in the /wp-content/plugins/codesnippet directory. A couple of quick thinks to check are:

    • Your permissions on the directory are correct. Even if the plugin doesn’t work, you should be able to see it as an option in the manage plugins page. If you’re not seeing it there, you’ve probably got a permission problem or something similar
    • If you do see the plugin in the management page, make sure that it is enabled and doesn’t throw any errors. If it throws and error, email it to me so I can see what’s going on.
    • Quantum says:

      I had an attempt at looking at the plugin as I to had discovered its not working. Trying to do a clean install via the plugins page said something about the plugin not having a valid header. In addition the readme.txt needs a little tweak to pass the validator (see: http://wordpress.org/extend/plugins/about/validator/)

    • Wyatt says:

      @Quantum, If you’re having issues with the plugin, please drop me an email with the specifics of what’s breaking. I’ve been running the current 2.1.5 version without issue. I’ll update the readme.txt to pass the validator in the next release since the only parts that are failing are screenshots (which I don’t have any) and the change log (which will replace the version history section).

      Again, let me know what problems you’re having so we can get you fixed up.

      Thanks,

      Wyatt

    • ma says:

      Hi

      I have the same problem as @Quantum. I added the plugin via the internal dashboard plugin install (Plugins / Add New) and at the end it said something like “The plug in does not have a valid header”. I cannot re-install (it says I already have it) and cannot use it (does not appear in the list of installed plug ins.

      WP 2.8.4 here.

    • Oliver Mezquita says:

      Looks nice! I’ll give it a try. Thanks!

    • Konferens Uppsala says:

      thanks dear for the post about hacker for hire, but the theme of hackers is much bad in minds of people. what you say?

    • giovanni says:

      thanks for this plugin. I’m using it for the first time but I have a problem with the output formatting of python code.
      I’ve written:

      def __init__(self):
          print "hello"

      and I get:

      1.
      def __init__(self):
      2.
      print “hello”

      How to avoid line numbers from showing? At least not in this way…

      thanks!

    • giovanni says:

      Nice: my code formats well in the previous comment, while in my blog I get the result I reported…

    • Wyatt says:

      giovanni:

      Under the Settings -> Code Highlighting, you can tune the CSS that is used to display code. Sorry it took me so long to get back to you, but if you’re still having problems, drop me an email at

      print "%s@%s%s" % ("wyatt", "hackerfor", "hire.org")
    • Code Snippet Highlighting | iBlott.com - Not Quite as Catchy You’d Think. But iLike says:

      [...] in http://blog.hackerforhire.org/code-snippet/ Engine [...]

    • 11 Plugins làm nổi bật code trong bài viết - wWw.RubicVn.cOm says:

      [...] Code Snippet WP Plugin [...]

    • WM says:

      <xml>
              <first_name><string>Mario</string></first_name>
              <thing1>Rossi</thing1>
              <thing2>001122334455</thing2>
              <thing3>Roma</thing3>
              <thing4>via del corso</thing4>
              <thing5>n.25</thing5>
      </xml>
    • groomedmonkey says:

      This plugin doesn’t show up in plugins list in WP 2.9.2 through the built-in plugin install. I notice it creates the directory “codesnippet-20″. I changed this to “codesnippet” but still doesn’t show up in plugins list.

    • Wyatt says:

      @groomedmonkey i think this is an issue with the way that i had the plugin organized in source control. I’ve not been able to get my WP install to allow me to do installations out of the repository, but if you’re willing to be a test monkey for me, I’ll see what I can do about making changes to get it to work. The last I had thought was that version 2.1.5 actually worked with the installation. Drop me a line at:

      #!/usr/bin/python
      print "%s@%s%s" % ("wyatt", "hackerfor", "hire.org")

      And we’ll see what we can work out because I’m all about making this better :)

    • Hacker for Hire » Blog Archive » Code Snippet Stable at 2.1.5 says:

      [...] was being tested correctly and well … it wasn’t. So if you’re having issues with Code Snippet, just roll back to version 2.1.5 and life should be [...]

    • Alison says:

      I installed the plugin and got this error “The plugin does not have a valid header.”

    • Alison says:

      I installed the plugin and got this error “The plugin does not have a valid header.”

      What do I do?

    • Serhan Buyukiscan says:

      @alison, I had the same error. Solution: get the inner folder one level up, i mean directly into the plugins directory.

    • Hacker for Hire » Code Snippet « earth_tech says:

      [...] the Code Snippet WordPress Plugin from the Hacker for Hire blog [...]

    • Php snippet tag « Phaddo Blog says:

      [...] plugin fà il suo lavoro. Possiamo prelevarlo da codesnippet e per le modifiche dare un occhiata a hackerforhire un altro [...]

    • 12个Wordpress代码高亮插件推荐 at Hello World! says:

      [...] Code Snippet [...]

    • Blog's Xuan Luat » Blog Archive » 12 WordPress Plugins to Display and Highlight Code within your Blog says:

      [...] Code Snippet WP Plugin [...]

    • Get him Back says:

      This plugin doesn’t show up in plugins list in WP 2.9.2 through the built-in plugin install. I notice it creates the directory “codesnippet-20″. I changed this to “codesnippet” but still doesn’t show up in plugins list.

    • MidnighToker says:

      firstly a big thank you for re-housing Code-Snippet -its lovely :)

      Just to let you know, the latest version doesn’t automatically install with wordpress; it downloads and extracts to plugins/codesnippet-20/codesnippet/ and then fails the install as its looking for the files in the subdir :)

    • Wyatt says:

      This is a test of the comment system

      #include
      int main(int argc, char** argv) {
        if ( argc &gt; 1) {
          printf("address is 0x%08x\n", argv[1]);
        }
        printf("done!\n");
      }
    • Gorchakoff.com » Blog Archive » Code Snippet says:

      [...] • actionscript-french • actionscript • ada • apache • applescript • asm • asp • bash • caddcl • cadlisp • c_mac • c • cpp • csharp • css-gen • css • delphi • diff • div • dos • d • eiffel • freebasic • gml • html4strict • ini • inno • java • javascript • lisp • lua • matlab • mpasm • nsis • objc • oobas • oracle8 • pascal • perl • php-brief • php • python • qbasic • sdlbasic • smarty • sql • vbnet • vb • vhdl • visualfoxpro • xml • and Ссылка на описание » [...]

    • 10 Best Syntax Highlighter Wordpress Plugins | TutorialChip says:

      [...] 6. Code Snippet [...]

    • Travels of a Commercial WordPress Plugin Developer 1 says:

      [...] just installed this code snippet plugin, which I might need to change its background [...]

    • Chase Pettit says:

      There still seems to be an issue with the install procedure. Installation created a “codesnippet-20/codesnippet” directory and I had to move every thing in the “codesnippet” folder up one level and then do the same for the contents of the “lib” directory.

      However, I’m still having an issue where the settings page doesn’t work. Copying “codesnippet-options.php” to wp-admin is not sufficient since it seems to be referencing some methods defined elsewhere.

    • Chase Pettit says:

      Is this comment system working correctly?

    • Wyatt says:

      It is now.

    • Cleanup your Blog with these 5 WordPress Plugins « Wiki Duh says:

      [...] Code Snippet A must have for any blog that displays [...]

    • 12 WordPress Plugins to Display and Highlight Code within your Blog : Trương Lê Hưng says:

      [...] Code Snippet WP Plugin [...]

    Leave a Reply

    You must be logged in to post a comment.