Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to blog code at wordpress.com [closed]

got a new blog at wordpress few days ago (http://ghads.wordpress.com) and I want to post some code snippets now or then. Is there anyway to make it look like code without paying for extra plugins?

like image 443
GHad Avatar asked Sep 17 '08 09:09

GHad


People also ask

How do I add code to WordPress com?

Simply edit the blog post or page where you want to display the code. On the post edit screen, add a new code block to your post. You can now enter the code snippet in the text area of the block. After that, you can save your blog post and preview it to see the code block in action.

Can WordPress com Take codes?

If we aren't careful, one site can be used to take down the entirety of WordPress.com. This is why we limit some of the things you post on your site. If you write some code or copy-and-paste from another site, and it disappears after publishing the post, the code is likely being stripped out as a security precaution.

What is the code for WordPress?

WordPress is written using PHP as a programming language. You definitely can use PHP if you want to develop for WordPress, but you don't have to.


2 Answers

See here: http://en.support.wordpress.com/code/posting-source-code/

Wrap your code in these tags: [sourcecode language='css'] .. [/sourcecode]

(or shorter [code lang='css'] .. [/code] )

Note that Visual Editor doesn't interpret the tags, you need to click Preview to see how it works.

Available language codes:

  • actionscript3
  • bash
  • clojure
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • html
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • vb
  • xml

Hope that helps.

like image 70
Alex Duggleby Avatar answered Oct 06 '22 11:10

Alex Duggleby


You can also use hilite.me. It doesn't require installation of plugins or JS/CSS files. It's also open-source and has an API.

Disclaimer: I'm the developer.

like image 29
Alexander Kojevnikov Avatar answered Oct 06 '22 11:10

Alexander Kojevnikov