Skip to main content

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)

Checklist for using shortcodes

  1. Write your article body first. Add shortcodes as separate paragraphs.
  2. Use the opening and closing tags as shown above. Place any parameters inside the opening tag.
  3. Put the content you want to display between the opening and closing tags.
  4. Preview your article. If a shortcode is not replaced, check for typos and spacing.
  5. Only use the parameters listed above for each shortcode.

Dynamic internal shortcodes (variables inside shortcodes)

New in v2: You can use special internal blocks (also called dynamic variables) inside any v2 shortcode. These are written as shortcodes inside another shortcode. The inner block's name becomes a variable for the template.
  • Write an internal block as [blockname]...[/blockname] inside the main shortcode's content.
  • The variable name will be the block name (for example, background, challenge, solution, outcome).
  • You can use any variable name that matches the template (see the template documentation or ask a developer).
  • All inner blocks are passed as variables to the template for that shortcode.

Example: Case Study with internal blocks

[case-study title="Royal Decree 15/2026 - case-study" date="April 2026"]
[background]Latvia’s treaty network is broad, with 63 agreements covering most of the countries remote workers deal with...[/background]
[challenge]Latvia’s treaty network is broad, with 63 agreements covering most of the countries remote workers deal with...[/challenge]
[solution]Latvia’s treaty network is broad, with 63 agreements covering most of the countries remote workers deal with...[/solution]
[outcome]Cross-border employment often turns on where the work is physically done...[/outcome]
[/case-study]
  • In this example, the variables background, challenge, solution, and outcome will be available in the template for [case-study].
  • If a variable is not set, the template may use the main content as a fallback.
  • This works for any v2 shortcode, not just case-study.
Tip: Internal blocks are optional. If you do not use them, the entire content between the opening and closing tags is available as content.

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.