Select Page

If you were wondering “How do I add syntax highlighting to a WordPress blog”, here is your solution.

If you want to share any code on your website it can be hard for people to copy and paste without weird formatting issues.

Luckily there is SyntaxHighlighter Evolved and it will color your code and put it in a container that is easy to copy and paste out of.

SyntaxHighlighter Evolved is a free plugin for WordPress. Here is a sample of what it looks like in action.

[php]<head>
<meta charset="<?php bloginfo( ‘charset’ ); ?>" />
<title><?php wp_title(); ?></title>
<?php elegant_description(); ?>
<?php elegant_keywords(); ?>
<?php elegant_canonical(); ?>

<?php do_action( ‘et_head_meta’ ); ?>

<link rel="pingback" href="<?php bloginfo(‘pingback_url’); ?>" />

<?php $template_directory_uri = get_template_directory_uri(); ?>
<!–[if lt IE 9]>
<script src="<?php echo esc_url( $template_directory_uri . ‘/js/html5.js"’ ); ?>" type="text/javascript"></script>
<![endif]–>

<script type="text/javascript">
document.documentElement.className = ‘js’;
</script>

<?php wp_head(); ?>
</head>[/php]

That is part of the header.php file that runs on dustinhyle.com.