If you are creating a guide on CSS, PHP or anyother expressions, you need to focus on that format or value so viewers can quickly go through it. Now the problem is how you will be able to do that?, do not it’s very easy as there are many plug-ins available.
We all know how bad value thoughts look when they considered in bare word without indentation and colour showing. WordPress does have a designed in <code> tag but it is fairly ineffective. It indents the supply requirements but does not have any service for selection expressions acceptance and format showing. Without colours and appropriate indentation, the value thoughts will look very unexciting and unsightly for viewers.
To solve this, developers have built their own syntax highlighter plugins for WordPress. fortystones uses Syntax Highlighter Plugin to highlight its code snippets.
But this time I don’t want to use the plugin, we will ‘inject’ this script into our template :
1. Download main script here : http://alexgorbatchev.com/SyntaxHighlighter/download/download.php?sh_current
2. Upload to your template folder, or use spesific folder /youtemplatefolder/js and /youtemplatefolder/css
3. Put this script to your functions.php
/* -- :[Inject Code To eader]: -- */
function shifnet_header()
{ ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/css-shcore.css" type="text/css" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/css-shdefault.css" type="text/css" />
<?php }
add_action('wp_head','shifnet_header');
/* -- :[Inject Code To Footer]: -- */
function shifnet_footer()
{
if(is_single()) { /* Load script only in Single page */ ?>
<!-- Load Brush Files -->
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shCore.js"></script>
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shBrushPhp.js"></script>
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shBrushJScript.js"></script>
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shBrushXml.js"></script>
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shBrushCss.js"></script>
<script class="javascript" src="<?php bloginfo('template_directory'); ?>/js/shBrushPlain.js"></script>
<script type="text/javascript">
SyntaxHighlighter.all()
</script>
<?php }
}
add_action('wp_footer', 'shifnet_footer');
4. To use this script, just :
<pre class="brush:php"> /* some code here */ </pre>
Reference :
- http://code.google.com/p/syntaxhighlighter
- http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html

Wow, cool idea so we can only load the script in single, thanks for the code!
Thank you
woo,this idea can speed up site load,thanks!
Thanks for this idea. Now I can styling my code with this tricks.
This is really usefull topic! Thanks!!!