11.Jul.2007 at 6:19 pm | hso
How to make your Codes “Friendly”
If you're new here, you may want to subscribe to our RSS feed. Thanks for visiting!
Have you found yourself wanting to display a piece of code in your blog post or a comment form that left you stripping off elements or re-pasting it over and over only to find that the code is actually being executed? I run in this issue a lot while replying to support questions, so I conveniently remove the < and > of all php script to allow the codes to show, this however cause more harm than help to the novice user and the experience is never that pleasant. Help is finally here!
A combination of using the “code” tag and converted the base code by using this cool converter called Postable makes for a delightful masterpiece that users can share, copy and paste without any hassles and guesswork. Here’s how you go about it.
- Copy your code (HTML or php or whatever) and paste it in the Postable post area (which at first will read “For your copy-and-pasting pleasure.”).
- Click the “make me friendly” button
- The code is converted to characters, for example < will be converted to & l t ;
- Copy the characters and past it on your blog post or comment within code tags
- That’s it.
In order to demonstrate how it works, I have copied and pasted a piece of code from one of our latest themes below:
<?php if ( is_home() || is_single() ) : ?>
<?php the_content ('Read the rest of this entry »'); ?>
<small>Published by <?php the_author() ?> on <?php the_time('F jS, Y') ?> | Filed under <?php the_category(', ') ?> | <?php comments_popup_link('Comment now »', '1 Comment »', '% Comments »', 'commentslink'); ?></small>
<br/><br/>
<div class="commentsblock">
<?php comments_template(); ?>
</div>
<?php endif // is_home() || is_single() ?>
Works!





1. rey | November 6, 2007 #
hi