WordPress shortcodes, what are there and where to use them.
Shortcodes are a WordPress feature that lets you place dynamic content into pages, posts, and widgets using a simple bracketed tag. You can think of a shortcode as a “placeholder” that WordPress replaces with real output when the page loads.
Schema Nerd uses shortcodes for display features, such as the hours widget, so you can show location details anywhere on your site without copying and pasting content into multiple pages.
This guide covers what shortcodes are, where they work best, and how to avoid the most common shortcode problems.
Quick answer
- A shortcode is a small tag like
[example]that outputs content when the page loads. - You can use shortcodes in pages, posts, many widgets, and some page builders.
- Shortcodes can appear “not to work” because of caching, editor settings, or theme limitations.
- Schema Nerd’s hours widget uses a shortcode so you can place hours anywhere and keep them updated from one source.
What is a shortcode?
A shortcode is a WordPress tag surrounded by brackets, like this:
[shortcode][shortcode option="value"]
WordPress processes shortcodes when it renders a page. That means you can place a shortcode in your content, and WordPress will replace it with generated output.
Shortcodes are common in plugins because they let you control output without editing theme files.
Where can you use shortcodes?
1) Pages and posts
Shortcodes usually work in standard WordPress pages and posts.
In the block editor (Gutenberg), the safest options are:
- A Shortcode block (if available)
- A Custom HTML block (for some shortcodes)
- A Paragraph block (works sometimes, but not always)
If you want consistency, use a dedicated Shortcode block when possible.
2) Widgets and sidebars
Many themes support shortcodes in widgets. Common places include:
- Footer widgets
- Sidebar widgets
- Header widget areas
If your widget area does not render the shortcode, it may be using a text widget that does not process shortcodes. Switching to a block-based widget area or enabling shortcode processing can solve it.
3) Page builders
Most page builders support shortcodes, but the placement method varies:
- Some have a specific shortcode module
- Some allow shortcodes in text elements
- Some require a dedicated HTML element
If the shortcode is not rendering, try a different element type inside the builder.
4) Theme templates (advanced)
Developers can add shortcodes in theme templates, but this requires code. If you are not comfortable editing templates, stick to pages, posts, or widgets.
Shortcodes and caching
Shortcodes generate content at render time. If a page is cached, you might not see changes immediately, especially if the shortcode output depends on settings you just updated.
If you update Schema Nerd settings and the hours widget does not update right away:
- Clear your WordPress cache plugin
- Clear your hosting cache
- Clear your CDN cache, if you use one
- Refresh the page in a private or incognito window
Caching is the most common reason shortcode output appears “stuck.”
Shortcodes in Schema Nerd
Schema Nerd uses shortcodes for display features that should be easy to place and easy to maintain.
Hours widget shortcode
The Schema Nerd hours widget is designed so you can:
- Place business hours on any page
- Avoid updating hours in multiple spots across your site
- Keep displayed hours aligned with your stored location hours
Customization improvements are coming soon, but the workflow stays the same: update hours once, then let the shortcode display the correct output.
Common shortcode problems and fixes
Problem: The shortcode displays as plain text
Example: you see [hours_widget] on the page instead of the widget output.
Fix:
- Make sure you are using a Shortcode block or the correct builder element.
- Some editors or widgets do not process shortcodes by default.
Problem: The shortcode renders, but the content is wrong
Fix:
- Confirm you are using the correct location selection, if your shortcode supports it.
- Clear caches. Cached pages can keep older shortcode output.
Problem: The shortcode does not render on some pages
Fix:
- Check if the page is built with a different template or builder.
- Test the shortcode on a plain WordPress page to confirm it works in a standard environment.
Problem: Styling looks off
Fix:
- Shortcodes output content, but styling is controlled by your theme.
- If the widget looks unstyled, your theme may be overriding default styles. Widget customization options are coming soon, and can help here.
Best practices for Schema Nerd shortcodes
- Use shortcodes for display, not for storing schema. Schema Nerd’s LocalBusiness schema outputs through the universal header.
- Keep one source of truth. Update location hours in Schema Nerd, not in multiple page sections.
- After changes, clear caches so you can confirm the live output.
Next steps
If you are troubleshooting display output, read:
If you want to manage hours properly: