Using dynamic data with custom post types and advanced queries

Hello guys,

We’re using Toolset (https://toolset.com/) to manage our CPTs.

On our home page we’d like to have a section that uses a “Featured” custom post type (Success Story) and have that section update automatically.

We could certainly create a “View” in Toolset that uses Pro HTML structure to achieve the desired result but we have to write the HTML by hand which can be sometime a little bit time consuming.

I was wondering if there was a way to do what we want directly with Pro Dynamic Data Fields instead?

In Toolset we have a “View” that queries 1 post (the most recent one) with the “featured” custom field value to “1”. In case there are two posts featured at the same time by mistake, only the most recent one would be displayed.

Currently, if I try to select a dynamic data from Toolset > Field, I can only use the Current/Next/Previous/Specific Post options.

Would it be technically possible to have a more sophisticated query here to be able to retrieve the same post I can target in Toolset? If yes can we retrieve things like the featured image URL?

Thank you!

Hi @thisisbbc,

Unfortunately, it is not possible using Dynamic Post because yes, these are the possible options only: Current/Next/Previous/Specific Post.

Alternatively, it is possible using ESSENTIAL GRID. It is a bundled plugin and works with custom post type. There’s also a skin editor so you can create the look you want.

Click X/Pro from wordpress admin dashboard and you can see it under Extensions:

Hope this helps.

Thank you for the reply Lely.

We do use Essential Grid but the builder is a bit overkill and even sometime limited in its own way.

If Pro/X implement a way to add “Custom Query” to the list of option in the Dynamic Data fields we will be able to achieve powerful stuff! For now I understand we’ll have to work something out.

It’s all workable with Toolset, but building with Cornerstone is a breeze so it would be nice to have everything under the same hood.

Maybe a suggestion for your devs?

Thank you for the consideration!

Hey @thisisbbc,

You would need to currently create your own Dynamic Content for this. Our core developer showed the hook for that and gave an example in this other thread: https://theme.co/apex/forum/t/using-dynamic-content-in-the-new-rating-element/64654/14?u=christian_y

That would require custom development though so it isn’t something that we could support.

Thanks.

Hey @christian_y,

Thanks for the provided link, I’ll make sure to check it out.

The ability to create our own Dynamic Content is great, although I always find it a bit daunting to play with the query.

For now we’ll have to work with this, but allow me to suggest two things…

  1. The ability to create custom queries via a simple point-and-click interface would expand DC considerably. Below is an example of the Toolset UI to configure a custom query. Since only one post has to be used with DC, it might look a bit different but maybe it can give a few ideas:
    Image #1: Toolset Query Builder

  2. Given I’m referring to Toolset, maybe another approach to expanding DC would be to have Cornerstone fully compatible with Toolset so that the DC Post and DC Field selection can be entirely handled with Toolset. The Post would then be selected via the Query Builder and the Field using the Field selection UI:
    Image #2: Toolset Field Selection

Hope you’ll consider improved compatibility between Cornerstone and Toolset :wink:

We can close this topic!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.