doncharisma, don charisma, Wordpress Code Box

Revisted – How to add a code box in free WordPress blog

In my previous blog post I wrote about building a code box like this one :

Code:

#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/


However, kindly another blogger has pointed out that a nicely numbered code box is already available in WordPress free. I couldn’t find it, not for lack of searching, so thanks to http://tpenguinltg.wordpress.com/ for enlightening me on this.

To get a code box like this :

#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/

You’d need to do it like this :

code box2

See WordPress official link in resources below for full details.

You could also use the <code></code> tags and you would get this :

#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/

Which is done like this :

<code>
#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/
</code>

You could also use the <pre></pre> tags which would look like this :

#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/

Which is done like this :

<pre>
#!/bin/bash
# rsync script
rsync -avh --exclude="*.bak" /home/user/Documents/ /media/diskid/user_backup/Documents/
</pre>

Also of note is that different type of code are recognised such as css, cpp, delphi, java, perl, php etc for full list see the official WordPress page below.

So now you have some choices !

Resources

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

https://doncharisma.wordpress.com/2013/07/04/how-to-add-a-code-box-in-free-wordpress-blog



17 thoughts on “Revisted – How to add a code box in free WordPress blog

    1. Hey there, my pleasure, glad to share the love 🙂 … Good luck with your writing career … I’ve added you on my links –> friends, you doing the same helps people find our blogs 🙂

      Keep in touch …

      Cheers

      Don Charisma

  1. I wish this good stuff was not over my head! I’ll get there… and I’ll keep track of you to help along the way. Glad you are here.

    1. Hey Jule, hope you get your aircon sorted, where I am it’s stupidly hot all the time and aircon a must at night …

      The techno stuff, well I’m a graduate so it’s normal to me …

      Good luck with your blog and life, keep in touch …

      Cheers

      Don Charisma

      1. Thanks Don,

        It is stupidly hot here, too. How the heck did people function in days of old? How did I, for that matter – back in the horse and buggy days prior to A/C? Ugh.

      2. Hey Ajule, it can reach 45 dec C (113 deg F) where I am … I used to have the aircon on a lot (expensive but I felt neccessary), until I came down with sinus problems … since then I’ve been getting used to the temperature and less AC … it’s hot all year round where I am and my theory is that we get used to the heat, but takes some time … the other thing that helps is to de-stress yourself 🙂

  2. I need your help!!! I want to place a Facebook thumbs up like button on the Morning Story and Dilbert Blog. Can you do a “How To” for a Post?? I like pic’s and elementary instructions, you know, simple stuff….. Thanks for the consideration….

    Take Care and god Bless 🙂 Kenny T

Leave a Reply for Don Charisma

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.