I’ve been building out a new site using the beta, and have come across some use cases I’d like to address. I can address many of these with custom code, but they also feel soooo close to functionality you guys are building that I figured I might as well mention them.
––
Maybe for this release:
Categories & Tags
We touched on this a few weeks ago in a prior thread, but will there be Categories/Tags in DC? And how is that going to work with hyperlinks? Most times, I’ll personally want to output links, but I can imagine some other times when I might just want text displayed (in some archive contexts).
Author Permalink
Maybe I’m missing something, but I can’t find a way to use DC to insert links to either the author archive or the website listed in the author’s profile (since the “user meta dropdown” isn’t working in Beta5, I looked through the options in the prior release version – and while I see options for the Instagram or LinkedIn urls, I don’t see any options for website)
- The use case here is that I’m building an author element using the layout builder, and I want to be able to link to their bio page on the site. For some clients that’d be just the author archive, but for others I might have a more custom “about” page, which I’d just add to their profile.
Post Type
Is there a way to pull post type with DC?
- The use case is that I’m building a new search results page, and I want to show whether something is a Page, Post, Location, Staff, How To Guide, etc. – many of those based on CPT.
I know I can do conditions based on post type, so I can always create a bunch of elements with conditions applied to them (similar to the woo badges in the starter templates). However, there are times when all that’s needed is a simple piece of text.
- Another way I was thinking about possibly using this is within the URL for an image element. For example,
url.co/wp-content/{{dc:post-type}}.jpg
and having corresponding file names for those. I could make the names simple enough so I wouldn’t run into spacing conflicts, but it might be useful to have an advanced option where you can reference the slug for the CPTs too.
––
For a future release:
Math in Dynamic Content & Conditions
@Misho mentioned some math functions in the conditions thread, and I’d love to be able to easily run calculations on dynamic content fields too. Here are a couple use-cases.
- To show sale amount on products. For example, when a product is on sale, display a “Save $10” or “Save 23%” badge etc.
- To take Misho’s example a little further, when close to a promotional threshold – show exactly how far they are away from it. For example, “You’re only $13.00 away from free shipping”, etc.
- Another example would be to compare two products’ prices. “Save $15 compared to option B”, etc.
- Another use case is comparing two dates. “Article posted 2 days ago”, etc.
- Another is a simple reading time calculation. People have different ways of calculating this, but the simplest is usually something like `(word count) / (200 words per minute)’. I did this on one site using functions.php, but native functionality would be sweeeeet.
- I guess this particular one would also require a DC option for word count too, but I think there’s a function for that somewhere within WP core…