1. Help
  2. Pages and content

Dynamic Blocks & Shortcodes

Dynamic blocks (also called shortcodes) are blocks that show live content. Instead of typing a list of posts or services into a page, you drop in a block, choose what it should show, and TruCMS builds the list from your real data every time the page is viewed.

Updated Nov 30, 20265 min read
On this page
  1. How dynamic blocks work
  2. Using a dynamic block
  3. Kinds of option
  4. Block catalogue
  5. Blog
  6. Blog Cards
  7. Advertisements
  8. Share
  9. Widgets
  10. Contact
  11. Where blocks appear
  12. Troubleshooting
  13. Related documentation

The Blocks panel scrolled to the Content and Booking blocks

Live blocks appear in the Blocks panel under categories such as Content, Forms, Booking and the TruCommerce groups.

How dynamic blocks work #

A dynamic block is stored on the page as a small placeholder together with the options you chose (for example layout: List, limit: 6). When someone views the page, TruCMS replaces the placeholder with up-to-date content. That means:

  • The list is always current. Add a service or publish a post and the page shows it without editing the page.
  • One block can show the right thing for each visitor, for example a signed-in customer’s own bookings.
  • In the editor, the block draws a live preview, so you can judge the layout while you edit.

Dynamic blocks and data-bound sections

Dynamic blocks read your data every time the page loads. Data-bound sections are designer layouts whose content is filled in from a record you pick and refreshed whenever that record changes. Use dynamic blocks for lists and functions (a booking form, a cart); use data-bound sections for richly designed presentations.

Using a dynamic block #

  1. In the Page Builder, open the Blocks panel and find the block in its category (use the search box).
  2. Drag it onto the page. The editor shows a loading placeholder, then a live preview.
  3. With the block selected, open Settings (the gear). Choose what it should show; the preview updates as you change options.
  4. Required choices are marked in the table below. If one is missing the block says Select … to load the preview.
  5. Save the page.

Settings panel of a selected Booking Services block

A selected block and its options in the Settings panel.

Kinds of option #

Control How to use it
Choice A menu of fixed choices. Many blocks have a Layout choice that picks one of several designs.
On / off A checkbox that shows or hides a part, for example Show price or Pagination.
Text / Number Type a value, for example the number of items or a button label.
Search and pick Start typing to search your own records (services, products, advertisements) and choose one.

Block catalogue #

The blocks below are available on every site. Blocks that belong to a module are documented with that module: Booking Page Builder Components and TruCommerce Blocks & Widgets.

Blog #

A simple list of your latest published blog posts, in the blog style of your theme.

Option Control Choices
Posts Number —
Category IDs Text —
Excluded category IDs Text —
Order Choice Latest, Oldest, Title, Random, Popular (default: Latest)
Pagination On / off —

Category options take category numbers separated by commas (shown in the Categories list in the admin).

Blog Cards #

Your published posts as designed cards in six layouts: a Classic grid, Horizontal rows, an Editorial overlay, a Slider, a Magazine arrangement and a Minimal list. Use it for “latest news” sections on home pages.

Option Control Choices
Layout Choice Classic grid, Horizontal, Editorial overlay, Slider, Magazine, Minimal list
Type Choice Recent, Popular (default: Recent)
Categories (IDs or slugs) Text —
Excluded categories (IDs or slugs) Text —
Search Text —
Posts Number —
Columns Number —
Pagination On / off —

Categories can be given as numbers or as their names’ slugs, separated by commas.

Advertisements #

Shows one of your advertisements where you place the block.

Option Control Choices
Advertisement required Search and pick —

Share #

Social sharing buttons for the current page, or for an address and title you provide.

Option Control Choices
Layout Choice Default
URL Text —
Title Text —

Widgets #

Displays all the widgets of one widget area inside the page, for example the Footer Area 1 widgets or the Blog sidebar. Enter the area’s identifier: sidebar (Homepage), categories-sidebar, tags-sidebar, pages-sidebar, post-sidebar (Blog), footer-1 to footer-6, trucommerce-shop-sidebar, trucommerce-product-sidebar, trucommerce-cart-sidebar or trucommerce-checkout-sidebar.

Option Control Choices
Widget area required Text —

Contact #

The site’s contact form. Visitors fill it in and the message is sent to the administration email set in Settings → General. If reCAPTCHA for the contact page is switched on there, the form includes it.

Option Control Choices
Layout Choice Full (default: Full)

Where blocks appear #

Dynamic blocks belong to page content, so they work on any page you build in the Page Builder, including the pages you assign in Settings → Page Setup as your shop, cart, checkout or booking pages. The blog posts pages and the built-in module pages have their own fixed designs; use the matching block to show the same information in a page of your own.

Troubleshooting #

Symptom What to do
The block shows nothing on the public page There may be nothing to show (no published posts, no active services) or a filter is too narrow. Check the options, and that the module is enabled.
The editor says Select … to load the preview Open Settings and fill the required Search and pick option.
The preview could not be loaded Check the selected values and try again. A deleted record chosen earlier can cause this: pick another.
A change to the data is not on the page A cached copy of the page may be served. See the FAQ.

Page Builder · Data-Bound Sections · Widgets · Booking Page Builder Components · TruCommerce Blocks & Widgets

Did this answer your question?