How to Easily Display Code on Your WordPress Site
- 1
- 0
- Опубликовано: 2021-03-16
Are you looking for the simplest instruction about, how to display code on wordpress site, because found that it is impossible to make it by default? In such case, you are on the right page. Now you will learn two quick methods to do that.
Setting of a plugin
The following algorithm of actions will help you to try this method:
1. Download and set up the Syntax Highlighter Evolved plugin (hereinafter software model).
2. Open up a page with Settings.
3. Go to a subcategory “Syntax Highlighter”.
4. Set, proper for you, settings of the software model. In most cases, default settings are right for all types of websites, but it would be nice to check them just in case.
The system you have just set up will display html code on website by using specific shortcodes. Pay attention, every language of programming has a proper set of microcode functions, by which it has to be wrapped. For example, if you deal with PHP, wrap your script in following way:
If you make everything right, it will be displayed on your site like on this picture:
If you use CSS, wrap script like it displayed on the following picture:
The result:
From now, every user of your site will be able without any problems to copy your code. The software model will by his own highlight the script to every concrete language.
Alternative way
You can also display code wordpress site without using any plugin, by doing encoding of the script into HTML entitles. Example:
The bad thing about this method — it is very difficult to do it by yourself, manually. But you can make things easier — just use special online instruments for encoding to display code. For example, among them, you can find a tool for converting code into HTML entitles. Using this tool, you will be able to paste languages of programming into posts on WordPress. If you want to try additional styling, put a code between two tags: <code> and </code>.