QOT Code Styler WordPress Plugin

QOT Code Styler WordPress plugin

QOT Code Styler makes the code in your posts easy to read and easy to copy. Every code block gets a clean code window, syntax colours and a Copy button, in new posts and old ones. It is based on the code style we use here on Quick Online Tips.

Free on WordPress.org. Install QOT Code Styler from your dashboard (Plugins > Add New, search for “QOT Code Styler”) or download it from its WordPress.org plugin page. Questions and help: the support forum. The source code is on GitHub.

What you get

  • A clean code window with a header bar, rounded corners and comfortable spacing
  • Syntax colours for comments, quoted text, HTML tags, attributes, keywords and numbers, good for HTML, CSS, JavaScript, PHP, Python and shell commands
  • A Copy button on every code block
  • Three looks: Dark, Light, or Automatic, which follows each visitor’s light or dark mode
  • Your own colours with the WordPress colour picker and a live preview
  • Mobile friendly: long lines wrap on phones, or scroll sideways like a code editor
  • Inline code and keyboard keys: file_name.php gets a neat highlight and Ctrl + C looks like real keys
  • Clean post summaries: code is left out of short summaries on home pages and archives
  • Readable by everyone: the built-in colours meet the WCAG AA contrast level
A code block with syntax colours and a Copy button in the dark look
A code block in the Dark look, with syntax colours and the Copy button.
The same code block in the Light look
The same post in the Light look.

Light and fast

  • One small stylesheet and one tiny script, with no outside library
  • Loads only on pages that show code. Other pages get nothing extra
  • Turn off the colours and the Copy button and it loads no JavaScript at all
  • Works with the standard WordPress Code block and classic <pre> code, so nothing breaks if you ever switch it off
QOT Code Styler code block on a phone with long lines wrapped
On a phone, long lines wrap so there is no sideways scrolling.

Change the look and colours

Go to Settings > QOT Code Styler, choose Dark, Light or Automatic, and pick your own colours. A live preview shows the result before you save, and a Default link under each colour undoes a change.

QOT Code Styler settings page with a live preview
Choose Dark, Light or Automatic, pick your colours and preview the result.

How to install

  1. In your WordPress dashboard, go to Plugins > Add New and search for QOT Code Styler, then click Install Now. Or download the zip from WordPress.org and use Plugins > Add New > Upload Plugin.
  2. Activate it on the Plugins screen.
  3. Open any post that has code to see the new look. To change the look or colours, go to Settings > QOT Code Styler.

Questions

How is this different from a full syntax highlighter?

Full highlighters understand hundreds of languages in detail, but load much larger files. QOT Code Styler is made for blogs, tutorials and how-to guides, where code is usually short. It gives you most of the look for a fraction of the weight.

Do I need a special block?

No. It styles the standard WordPress Code block and classic <pre> code you already have.

Which languages are coloured?

The colouring is simple and general, so it suits most short code you would show in a blog post: HTML, CSS, JavaScript, PHP, Python, shell commands and similar. You do not need to pick a language.

How do I show a keyboard key?

Wrap the key in kbd tags, for example <kbd>Ctrl</kbd>. In the block editor, use Edit as HTML on the paragraph.

What does Automatic do?

It shows the light code window to visitors who use light mode on their phone or computer, and the dark one to visitors who use dark mode.

Can I turn off the JavaScript?

Yes. Turn off both Syntax colours and Copy button in the settings, and the plugin loads only its stylesheet.

My page builder’s code is not styled.

The plugin looks for code in the post content. If your builder stores content elsewhere, add this to your theme’s functions.php to load the styles on every page:

add_filter( 'qot_code_styler_load', '__return_true' );
Does it slow my site down?

No. It adds one small stylesheet and one tiny script, only on pages that show code.

More WordPress Plugins

Need customization? We wrote this plugin, so we can add a feature or change how it works for you, delivered as a ready-to-install zip. No WordPress login needed.

See our customization service →

Found this useful? Share it with someone who needs it.