Embed PHP, CSS Codes in WordPress with SyntaxHighlighter Evolved Plugin

By WP Saviour •  Updated: 03/02/21 •  2 min read

I’ve been writing about WordPress and plenty of Thesis customization posts right here at WPSaviour from lengthy. Earlier I used to make use of an addon for Home windows Reside author which made my work simpler to embed code in WordPress submit. Although in a while that addon was not up to date and subsequently I needed to search for one other choices to point out codes in my WordPress posts.

Right here I’m sharing a few helpful WordPress plugin name SyntaxHighlighter Developed plugin which can make your work simpler to embed code in your weblog submit. Specifically when you write a Weblog on coding, that is the plugin which can make your work simpler. This plugin comes with respectable settings choices like totally different colour themes for highlighting codes, line numbers on or off, toolbar for simple copying and so forth. You’ll be able to entry the settings from Settings > Syntax Highlighter

syntex-highlighertsettings-2643436

The best way to Add codes utilizing SyntexHighlighter WordPress plugin?

Embedding code utilizing this plugin may be very simple. All you might want to do is add the shotcodes relying upon the code. Yow will discover the reference from the setting web page of this plugin: For instance. use

example-shortcodes-550x90-2971645

Listed below are codes that are added by utilizing this plugin : You don’t want so as to add the shortcode in HTML mode, you should use visible mode in submit editor to embed codes utilizing this plugin.

Embeding css code by including the code between CSS shortcode:

css-embeding-6307937

[css] .customized #header_area {show:none;} .customized #header {padding: 0;} .customized #web page {padding:5px 20px;}

[/css]

Embeding Php code between php Shortcode:

[php] //Auto Thumbnail Code perform joe_auto_thumb(){ international $submit, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all(‘//i’, $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){return $first_img= “https://www.WPSaviour.com/wp-content/uploads/2011/03/sml-125×125-default.jpg”;} else {return $first_img;} } add_action(‘init’, ‘WPSaviour_auto_thumb’);

[/php]

Since this plugin is authored by Automattic (WordPress dad or mum firm), I can advocate this plugin as among the finest WordPress plugin to embed codes.

gp-6074034 as-2120867

WP Saviour