Modifiers for dynamic content?

I looked in the Docs, but if it’s there, I couldn’t find it… do you have any documentation for other modifiers similar to fallback="" and length="" that can be used with dynamic content? Or are those the only ones?

I’m just curious if there are other things that can be accomplished with DC that might not be immediately obvious to try.

1 Like

Hey @devinelston! Great question. A few notes on that:

  • fallback is the only universally supported argument
  • Any Dynamic Content items that add additional arguments will have them represented in the mini inspector (e.g. Length on excerpts)
  • Post Meta is the only exception and supports type which can be set to data or time. When you set the type, a format parameter becomes available which lets you pick a date or time format. If you don’t set a format the respective WordPress default will be used. We introduced this as somewhat of a stopgap. As Dynamic Content has matured, we will probably need to add more universally applicable modifiers to transform any strings arbitrarily.
1 Like

Thanks @alexander!

Have you guys discussed the ability to set DC as fallback for other DC?

One particular use case I’m looking to replicate is the “Alternate Index Title” option for blog posts (setting a title that shows up differently on archive pages, etc). With the new condition expressions, it looks like I can replicate that functionality by creating two different headline elements and adding a condition looking at whether one of the strings is empty… however it’d be so much cleaner to be able to just nest two DC fields like:

{{dc:post:meta key="_x_entry_alternate_index_title" fallback="{{dc:post:title}}"}}

I assume this gets complicated, but just sharing in case it’s a straightforward thing to implement.

1 Like

Love the idea! It is on the more complicated end, but if we made a parser that allowed nesting like this it opens up all kinds of fun possibilities - we’d be a whole lot closer to things like expressions and math being done in the template strings as well.

3 Likes