Shortcodes v2
This guide explains, in plain English, how to write and manage shortcodes using the applyShortcodesV2 system. All examples and parameters are taken directly from the project codebase. No technical or PHP knowledge is required.
What are shortcodes?
Shortcodes are special tags you can add to your article content. The system will automatically replace them with the correct content or widget when the page is shown to readers.
How to write a shortcode
- Shortcodes are written inside square brackets, for example:
[legal-warning]or[case-study]. - Some shortcodes can have parameters (attributes) inside the opening tag, for example:
[case-study title='Example']. - Some shortcodes can have inner text between opening and closing tags, for example:
[legal-warning]Important notice[/legal-warning]. - Always place shortcodes on their own line, with a blank line before and after.
- Do not place a shortcode directly below a heading.
Available shortcodes (applyShortcodesV2 only)
Below are five shortcodes you can use. Each one has an opening and closing tag, and may accept parameters or inner text.
[legal-warning]...[/legal-warning]
[lawyers-insight]...[/lawyers-insight]
[case-study]...[/case-study]
[legislation-alert]...[/legislation-alert]
[jurisprudence]...[/jurisprudence]
Examples with parameters and inner text
[legal-warning title='Important']Please read this notice carefully.[/legal-warning]
[lawyers-insight author='Jane Doe' role='Senior Lawyer']This is an expert comment.[/lawyers-insight]
[case-study title='Landmark Case' summary='Brief summary here.']Full case details go here.[/case-study]
[legislation-alert title='New Law' date='2025-01-01']Law text or explanation.[/legislation-alert]
[jurisprudence case='Supreme Court 2024' citation='123/2024']Jurisprudence details here.[/jurisprudence]
Possible parameters (attributes)
- legal-warning:
title - lawyers-insight:
author,role - case-study:
title,summary - legislation-alert:
title,date - jurisprudence:
case,citation
Checklist for using shortcodes
- Write your article body first. Add shortcodes as separate paragraphs.
- Use the opening and closing tags as shown above. Place any parameters inside the opening tag.
- Put the content you want to display between the opening and closing tags.
- Preview your article. If a shortcode is not replaced, check for typos and spacing.
- Only use the parameters listed above for each shortcode.
Summary
Shortcodes are a simple way to add special content blocks to your articles. Use the exact bracket syntax, keep them on their own paragraph, and use only the parameters shown in this guide. The system will handle the rest automatically.