Easy Code Snippets with Prism.js

Few days ago I published an article about highlighting code in Ghost and I decided to do the same with WordPress for embedding code snippets easy . You may tell that there are hundreds of plugins for that, but I don't like installing tens of plugins.

Here is what you'll see after finishing this tutorial:

add_action( 'pre_get_posts', 'minimum_toolbox_items' );
function minimum_toolbox_items( $query ) {

    if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'toolbox' ) ) {
        $query->set( 'posts_per_page', '12' );
    }

}

Ok, lets cut to the chase.

Download source files

Use this form to download source files, you will also help us by sharing this post. Thanks!

[sociallocker]
87syntax
[/sociallocker]

Install Prism

Just use your FTP program to upload extracted files on server and add one line of code to your functions.php file.

1. Upload  87syntax folder to wp-content/theme-name/.

2. Enqueue scripts to your functions.php.

It's very easy, just add this line to your functions.php file

require( '87syntax/87studios-syntax.php' );

How To Use

That’s pretty much easy, use php html css javascript shortcodes around the code:

[ php ] code goes here [ /php ]

I hope this tutorial will help you. Enjoy!

Divi 2.0 WordPress Theme

Like what you read here in this blog post? If yes, please sign up and get latest articles delivered to your email account for FREE! You’ll be also subscribed to newsletter, where I share a exclusive content and offers.

About Kris Hoja

Hi! I'm Kris. For a while I was blogging about WordPress, now I'm owner of HogStudio - Creative Agency focused on website development.
Add me on Google+ and don't forget to follow me on Twitter :)

Leave a Reply