Appearance
WordPress Functions
WordPress functions integrate with WordPress core features for content rendering and media handling.
content
Applies the WordPress the_content filter to a string. This processes shortcodes, auto-paragraphs (wpautop), embeds (oEmbed), and other content filters.
Signature: content(value)
<{content(row.post_content)}>WARNING
Always use the <{ }> (raw HTML) delimiter with content(), not { { }}. The content filter produces HTML that should be rendered, not escaped.
The output is sanitized via wp_kses_post() (when using <{ }>), which strips dangerous tags like <script> while preserving safe HTML.
What the content filter does
- Converts double line breaks to
<p>tags (wpautop) - Processes WordPress shortcodes
- Converts oEmbed URLs to embedded media
- Applies any filters registered on
the_content
// Input: "Hello world\n\nThis is a paragraph."
// Output: "<p>Hello world</p>\n<p>This is a paragraph.</p>"shortcode
Processes WordPress shortcodes in a string. Unlike content(), this does not apply wpautop or other content filters -- it only processes shortcodes.
Signature: shortcode(value)
<{shortcode(row.widget_code)}>
// Processes [gallery ids="1,2,3"] or [contact-form-7 id="123"]<{shortcode('[gallery ids="' ~ row.image_ids ~ '"]')}>
// Dynamically build a shortcodeWhen to use shortcode vs. content
- Use
content()for post content that should be fully rendered (paragraphs, embeds, shortcodes). - Use
shortcode()when you only need shortcode processing on a specific string.
wp_image
Returns the URL of a WordPress media attachment by its ID and size.
Signature: wp_image(attachmentId, size?)
| Parameter | Type | Default | Description |
|---|---|---|---|
attachmentId | number | -- | The WordPress attachment ID. |
size | string | full | The image size: thumbnail, medium, large, full, or any registered size. |
`{ {wp_image(row.featured_image_id)}}`
// "https://example.com/wp-content/uploads/2025/03/photo.jpg"
`{ {wp_image(row.avatar_id, 'thumbnail')}}`
// "https://example.com/wp-content/uploads/2025/03/photo-150x150.jpg"Returns an empty string if the attachment does not exist or the function is not available.
Common image sizes
| Size | Typical Dimensions |
|---|---|
thumbnail | 150x150 (cropped) |
medium | 300x300 (max) |
medium_large | 768px wide (max) |
large | 1024x1024 (max) |
full | Original dimensions |
Use in HTML
html
<img src="`{ {wp_image(row.image_id, 'medium')}}`" alt="`{ {row.title}}`">Or in an Image widget's source binding:
`{ {wp_image(row.photo_id, 'large')}}`Examples
Render a blog post
<h1>`{ {row.post_title}}`</h1>
<p class="date">`{ {date_format(row.post_date, 'F j, Y')}}`</p>
<{content(row.post_content)}>Dynamic shortcode with row data
<{shortcode('[product_card id="' ~ row.product_id ~ '"]')}>Featured image with fallback
`{ {default(wp_image(row.featured_image_id, 'large'), '/images/placeholder.jpg')}}`