DALE: Display A Single Post With A Themer Custom Template

This example uses the Doctor And Location Example (DALE).

In this example a Cwicly template will be created to display each individual Doctor in their separate post.

Here are some references:
Youtube About Cwicly Themer
Youtube Single Post Template
Cwicly Docs Themer

Lets start:

First we create a new “Custom Template” to display our Doctor posts.

For that we open the Cwicly → Themer in the Wordpress backend.
grafik

Then we create a new Custom Template.


We call it “Posts Doctor”:
grafik

In the newly opened POSTS DOCTOR custom template we select the visibility conditions, to specify when this template should be displayed.
grafik

In the visebility conditions we chose “Show if” it is a “Singular” post in the “Doctors” post type.

Now lets start editing
grafik

I created a section which includes:
A heading for the title of the post
A query to display the locations selected in each separate Doctor location.
grafik

Here are the Locations displayed, which I related to each Doctor.

For the heading I use the dynamic data of the Wordpress “Post Title”, so each doctor has his name (Post Title) displayed.
grafik

Now we select the query and toggle the “Query From URL” to get in the “Query Editor”.
Animation (17)

In the “Query Editor” we select Location because we would like to display the Locations which the Doctor works in.

Hint: a little styling was done for better presentation

Now all Locations are displayed, which we don’t want! We only want the related Locations for each Doctor.
This relation is from Doctor 01 and can be found in the Simple DALE setup.
grafik

To achieve this we simply use the include posts field of the query. with this only the selected posts will be displayed. We also select the dynamic field because the data for each post is different. Now we select the source as ACF, the ACF Group as Doctor Relation and the ACF Field as Locations of Doctor. These Values can be seen in the image above and are described in the DALE example.

In short we lay the path to a Doctor and specify to only display the selected fields from the ACF relation field.

As there is no query content found we select the dynamic preview on the top bar and select Doctor 01.

grafik

Well usually this works and the content will be displayed but it seems there would be a little bug?

Non the less, if you save and now view the doctors as separate posts they will be displayed correctly.

Hope this helps :wink:

If you have comments or questions to this topic please leave a reply. For other DALE related questions please visit the the DALE post.

3 Likes