To overcome the advantages of WordPress has many plugins developed by competent developers around the world to solve various problems and add various functions so that WordPress can be used for various things. To display the code in
WORDPRESS CODEX |
HOW TO DISPLAY CODE IN BLOG WORDPRESS POSTING
In this article I will give an example of using a plugin named SynatxHighlighter Evolved to display the code in WordPress, And at the bottom I will also provide some alternative plugins that also have the same functionality.
To start
Once your plugin is enabled, Please go to the plugin settings page in Settings menu »SyntaxHighlighter to configure plugin settings.
By default, these plugin settings already work for most websites. However, you should review all settings and make changes if necessary. And in each option is a description to explain the purpose of the arrangement. If your settings are already sufficient, please click the save changes button to save your settings.
Syntax Highlighter Evolved uses a simple
To display the PHP code you will wrap your code like this
[HTML] Your code is here [/ HTML]
This will appear in your post like this:
<?For CSS you will wrap your code like this:php echo "Hello World"; ?>
[CSS] Your code is here [/ CSS]
It will appear on your site like this:
Syntax Highlighter will automatically highlight the code for a particular language. It will also add the line number and handle the indent tabs correctly. Your users can easily copy and paste the code snippet from your WordPress site.. entry -title {font -family: "Open Sans",arial , sans-serif;font -size: 16px;color : # 272727;}
PLUGIN TO DISPLAY CODE IN WORDPRESS - WORDPRESS CODEX
Inserting code snippets into WordPress is easier for you to embed and make it easier for users to read.
1. SYNTAXHIGHLIGHTER EVOLVED
SyntaxHighlighter Evolved is a plugin that I use as an example in this article and it is also a plugin I use on my blog
Syntax SyntaxHighlighter 1
Main feature:
Added syntax highlighting to the code snippet
Different theme color options
Can add a special CSS class for styling options
2. CRAYON SYNTAX HIGHLIGHTER
Crayon Syntax Highlighter is another popular plugin that can add line numbers and code syntax to the code snippet
You can also do things like automatically duplicate Sublime Text style (popular code editor):
Main feature:
Add a line number to your code snippet
Added syntax highlighting
Supports 65 different languages
Many styles, some of which mimic popular code editors
Box code easily adjusted to display your WordPress theme
3. OBED GIST
Then, you just need to paste your query URL into WordPress Editor and the plugin will automatically embed your code snippet like this:
Main feature:
Take advantage of GitHub Gist
Embed the cursor by pasting the URL
Can embed certain revisions or single files from multi-file files
4. WP-GESHI- HIGHLIGHT
WP-GeSHi-Highlight is another plugin that adds the line number and Highlight code syntax that you paste in the WordPress editor. As the name suggests, it is based on the GeSHi Highlight engine. It also lets you use standard tags as long as you specify the encoding language.
WP-GeSHi-Highlight is lightweight, both in terms of functionality and code output:
Main feature:
Add Highlight
Added line numbering
Embed using tags
Lightweight - just add one HTTP request
5. PASTEBIN
Pastebin is another website for sharing code snippets. This is very similar to the Gist GitHub tool I mentioned in number three. And as with GitHub Gist, this plugin makes it very easy to embed the Pastebin code into your WordPress site.
All you need to do is add your code to Pastebin, then you can simply paste the Pastebin URL into your WordPress editor to automatically insert your code snippet like this:
Whether the code has syntax highlighting will depend on the settings you use in Pastebin.
Main feature:
Embed code directly from Pastebin
Includes line numbers and (optional) Highlight
Just paste the URL into WordPress Editor
Can also be pasted by using
And that's an easy way to install or display the code in a WordPress post to make it look perfect and work well when copied by your visitors. And also some plugins that you can choose to make WordPress capable of displaying the code perfectly.
Hopefully this article useful for you and good luck