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?
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.
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.
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.
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:
Hope that helps.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With