Skip Navigation

[Resolved] Modify the WP Query with a Custom Field Post ID

This thread is resolved. Here is a description of the problem and solution.

Problem:
Modify the WP Query with a Custom Field Post ID - how to display nested shrotcode view with elementor

Solution:

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/modify-the-wp-query-with-a-custom-field-post-id/page/2/#post-2037605

Relevant Documentation:

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 19 replies, has 2 voices.

Last updated by kristofG 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2037121
Screenshot_2.png
Screenshot_1.png

Hi,
I tried that, but I get an overview of all Expertises (Pages) and CPT Cases followed by [/types]"]

#2037559

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've created the following content templates and added the view's within that related content templates:
=> hidden link
=> hidden link

And then added the content templates as given under within shortcode module:

[wpv-post-body view_template="ct-to-display-related-expertise"]
[wpv-post-body view_template="ct-to-display-related-cases"]

Can you please confirm now it works as expected.

#2037563

It works, but why? 🙂 The Content Templates are not assigned to any Post types or Taxonomies.

So why does [wpv-view name="related-case" related="[types field='related-case'][/types]"] in the Elementor Template not work, but when you place the same code in a Content Template and load the CT in Elementor, it works?

#2037605

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Because Elementor's shortcode module does not able to parse the nested shortcode we added like:

[wpv-view name="related-expertise" related="[types field='related-expertise'][/types]"]

The workaround is that I shared is we created the content template that holds the view:

[wpv-view name="related-expertise" related="[types field='related-expertise'][/types]"]

And added the content template shortcode within the Elementor's shortcode module:

[wpv-post-body view_template="ct-to-display-related-expertise"]
[wpv-post-body view_template="ct-to-display-related-cases"]

As we are using content template as container that holds the view, its not required to set content template to display with any post type or taxonomy.

#2042147

Minesh has been EXTREMELY helpful. Thank you!