Skip to content

Post Fields Anywhere

The Post Fields Anywhere function provides a dynamic tag that lets you display any Voxel post field from any post, anywhere on your site. Access field values, taxonomies, locations, and more using a simple syntax.

Overview

Voxel’s @post() dynamic tags normally only work within the context of the current post. This function extends that capability by allowing you to render any @post() tag for any post ID on your site. Perfect for displaying related content, cross-referencing listings, or building custom dashboards.

Key Features

  • Access any post field by ID
  • Full @post() tag support
  • Works with taxonomy fields
  • Works with location fields
  • Works with image/media fields
  • Supports all Voxel modifiers
  • Use anywhere dynamic tags are supported

Setup Instructions

Enable the Function

  1. This is always enabled, so no enabling needed.

The @site().render_post_tag() dynamic tag is available.

Usage Syntax

@site().render_post_tag(post_id, @post(...))
ParameterDescription
post_idThe numeric ID of the post to get data from
@post(...)Any valid Voxel @post() dynamic tag

Examples

Basic Field Access

// Get post title
@site().render_post_tag(123, @post(:title))

// Get post content
@site().render_post_tag(123, @post(:content))

// Get custom field value
@site().render_post_tag(123, @post(custom_field_key))

Taxonomy Fields

// Get taxonomy label
@site().render_post_tag(123, @post(category))

// Get taxonomy slug
@site().render_post_tag(123, @post(category.slug))

// Get taxonomy ID
@site().render_post_tag(123, @post(category.id))

Location Fields

// Get latitude
@site().render_post_tag(123, @post(location.lat))

// Get longitude
@site().render_post_tag(123, @post(location.lng))

// Get full address
@site().render_post_tag(123, @post(location.address))

Image Fields

// Get logo/featured image
@site().render_post_tag(123, @post(logo))

// Get gallery images
@site().render_post_tag(123, @post(gallery))

With Modifiers

// Convert title to uppercase
@site().render_post_tag(123, @post(:title)|uppercase())

// Use fallback value
@site().render_post_tag(123, @post(logo)|default(@post(:logo)))

// Truncate text
@site().render_post_tag(123, @post(:content)|truncate(100))

Use Cases

Display information from related listings by their IDs stored in a relationship field.

Cross-Reference Data

Show data from a parent listing on child pages, or vice versa.

Custom Dashboards

Build admin dashboards that display data from multiple posts in one view.

Email Templates

Include field values from specific posts in notification emails.

Static Reference Sections

Display information from a specific post (like a settings or about page) anywhere on your site.

Troubleshooting

Tag Returns Empty

  • Verify the post ID exists and is published
  • Check that the field key is correct
  • Ensure the field has a value for that post
  • Verify the function is enabled

Tag Not Recognized

  • Make sure you’re using the correct syntax
  • Dynamic tags require @site() prefix for this function
  • Check for typos in the tag name

Modifiers Not Working

  • Modifiers go after the @post() tag, before the closing parenthesis
  • Use pipe | character to chain modifiers
  • Check Voxel documentation for available modifiers

Built by Code Wattz.