WP Manifestindependent plugin directory
manifest / content / short-code-shortcodes

Short Code Shortcodes

WordPress plugin for shortcodes rendering <code> and <pre><code> with content converted to htmlentities & disabling wptexturize.

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/joostkiens/short-code-shortcodes/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress plugin for shortcodes rendering <code> and <pre><code> with content converted to htmlentities & disabling wptexturize.

Description

This WordPress plugin adds two shortcodes for rendering code:

  • [code] for inline code
  • [precode] for blocklevel code

These shortcodes solve 2 problems:

  • Ocassional auto transformation to smart quotes. WP should not convert quotes to smart quotes between <pre> & <code>, but sometimes it happens anyway. These shortcodes explicitly disallow the use of wptexturize.
  • The need to manually convert html tags, etc to htmlentities. The shortcodes convert the content to htmlentities (no quotes, utf-8)

Usage

[code]<p>This is the "code" shortcode, for in-line code. Use it in the same way as you'd use <code>.</p>[/code]

[precode]
<p>
    This is the "precode" shortcode, for block-level code.
    Use it in the same way as you'd use <pre><code>.
<p>
[/precode]

Shortcode attributes

There are no functional attributes.

Core HTML attributes are allowed and get rendered in the resulting html. Example: [code class="code-html" lang="fr-FR"]<h1>Le monde est a nous</h1>[/code]

Installation

  1. Upload short-code-shortcode folder to wp-content/plugins/
  2. Activate plugin through the 'Plugins' menu in WordPress

Change log

0.2.1

  • Fixed formatting error is README.md

0.2.1

  • Added [code] and [precode] buttons to TinyMCE's kitchensink & Quick tags

0.1.1

  • Added trim function to the clean_code_content method

0.1.0

  • Initial commit