Install and use the code Highlight plug-in Highlight in wordpress

Source: Internet
Author: User


Plug-In Download: http://file.111cn.net/upload/2014/2/wp-code-highlight.zip

(1) decompress the downloaded package to obtain the wp-code-highlight folder, upload it to the/wp-content/plugins/directory, and enable the package in the background.

(2) because the wordpress visual editor will escape the code back and forth, it is best to disable it. Method: after logging in, & rarr; user & rarr; click your account & rarr; click "disable Visual Editor" on the first option"

(3) customize the plug-in by logging on to & rarr; settings & rarr; WP Code Highlight

(4) place the Code in the middle of <pre> and </pre> when writing an article. (a button named WP-Code-Highlight has been provided in the Html editor, to facilitate code insertion ).

(5) If you used WP-Syntax, you can still use the original method to insert Code. WP Code Highlight is fully compatible with the WP-Syntax Code insertion style. This ensures you have no worries about the transition.

(6) "Code Button": Select "enable" and insert a Button named "WP-Code-Highlight" in the Html editor to facilitate Code insertion.

(7) "Highlight Themes": four different code Highlight Themes can be selected, or "random" can be selected to randomly display the code Highlight Themes. In addition, WP Code highlightsupports searching for the javaswp-code-highlight.css file in the wordpresstopic folder. If wp-code-highlight.css exists, it is automatically called. Hosts file.

(8) "Line Numbers": if "enable" is selected, the code Line number is displayed. If "disable" is selected, the code Line number is not displayed.

(9) "Delete Options": if this option is selected, the setting Options in the database can be automatically deleted when the plug-in is disabled.

= WP Code Highlight Code highlighted demo =

Enter the following content in the article or comment:

<Pre>
# Include <iostream>
Using namespace std;
Void main (void)
{
Cout <"Hello World" <'n ';
}
</Pre>

Highlight of the foreground:

# Include <iostream>
Using namespace std;
Void main (void)
{
Cout <"Hello World" <'n ';
} = FAQ =

① Which roles can post code in the article?
A: Only users with the role "administrator" can use the pre label to wrap the code. Wordpress imposes input restrictions on non-administrator users. For example, the code containing PHP angle brackets has been processed before the database is saved. This is for security consideration, there is no input restriction for the administrator, but it is only processed when the front-end is displayed. The function of the code highlight plug-in can be used to prevent the administrator's code from being processed when the front-end is displayed.

② Which roles can post code in comments?
A: You can use the pre label to wrap the code only if the role is "administrator. Non-administrator or common visitor does not work for the same reason. Someone may wonder why anyone, including visitors, can post code in the comment box below. This is not a plug-in function and it is quite troublesome to handle.

③ Why can't I see the "code button "?
A: The Code insert button is displayed in the HTML editor named "WP-Code-Highlight", which facilitates you to insert the pre tag. For those who often need to post code, we recommend that you disable the visual editor. The method above is shown, because switching back and forth will escape the code back and forth, which is messy, and the article source code written by the visual editor is redundant. The source code of the articles written in the HTML editor is neat and standardized.

④ What programming languages does the WP Code Highlight plug-in support?
A: My friends who asked this question are probably bored by other code highlighting plug-ins. Because other plug-ins require a bunch of tag attributes, I am glad to tell you that, the WP Code Highlight plug-in does not support languages that are not supported. You do not need to specify a language. All programming languages support this. You only need to package the pre label, the principle is that the pre-label package code can be normally displayed on the front end, and then the syntax features are colored using js. Different language types are just different for this plug-in, for programming languages in the "C, Bash, and XML-like" style, the coloring of other programming languages is just monotonous, without affecting the normal display of codes. This is exactly the original intention of developing this plug-in for ease of use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.