Skip Navigation

[Resolved] Issue with Site Review Plugin and WP_query loop with Toolset

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

Problem:
The user would like to use the Site Review plugin on custom post types defined by Toolset.

Solution:
This possible using nested shortcodes:

[site_reviews assigned_post="[wpv-post-id]"]
[site_reviews_form assigned_post="[wpv-post-id]"]

However, nested shortcodes are not supported by Elementor, it needs to be added inside a Toolset content template. Then you can include the content template inside Elementor using a shortcode:

[wpv-post-body view_template="Current Post Reviews Form"]
[wpv-post-body view_template="Current Post Reviews"]
This support ticket is created 3 years, 8 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9: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: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by JensP9777 3 years, 8 months ago.

Assisted by: Jamal.

Author
Posts
#2017065

Hey guys,

I created custom post types with Toolset and would love to add a review plugin to every page.

I found https://wordpress.org/plugins/site-reviews/ to be a great fit.

They are using the global post ID as a identifier for each post. Sadly it wont work for the custom post types created with Toolset (the global id do not get connected to the review)

After asking their support I got this answer:

The "post_id" value in the assigned_posts option tells Site Reviews to use the global Post ID. If you are using a custom WP_Query loop, make sure that you are doing it correctly.

See: https://developer.wordpress.org/themes/basics/the-loop/#resetting-multiple-loops

If you are using a plugin for this, then it's likely not setting/resetting the global post in the loop. In this case, you will not be able to use "post_id" as the value and will need to enter the actual numerical Post ID.

--------------------------------------

Is there any way to set / reset the global post in the loop on the custom post type from toolset?

Thanks!

#2017079

Hello and thank you for contacting the Toolset support.

Toolset does actually modify the global loop and global $post object, but I am sure we do it the right way unless you can provide a clear bug report(steps to reproduce, expected outcome, actual outcome).

Maybe you are just not using the correct post_id, I need to take a closer look at your website to check this further.

Note that you can use Toolset shortcodes to pass the ID to the plugin's shortcodes. For example:

[site_reviews assigned_post="[wpv-post-id]"]
[site_reviews_form assigned_post="[wpv-post-id]"]

If that does not help, would you like to reproduce this issue on one of our test sites and let me see how we can fix it? You can log in to one test site using the following URL hidden link
Toolset plugins are already installed, just install the plugin, create a custom post type and a post and reproduce the issue. Explain what have you done so far, what would you expect and what do you get:
1. I go to xxx
2. I do xxx
3. I expect to have xxx
4. Instead, I get xxx

#2017123

Wow, thanks for your quick reply with your suggestions and even a ready sandbox for testing!

I reproduced the problem

1. Created a CPT
2. Installed Elementor
3. Added a shortcode in the custom post type on elementor
4. Added a review
5. The assigned post is still empty

hidden link

#2017451

Thank you for your collaboration. I believe there is no compatibility issue between Toolset and the Site Reviews plugin. The issue is probably in the whole integration with Elementor. Elementor does not seem to accept nested shortcodes such as:

[site_reviews assigned_posts="[wpv-post-id]"]

That's why the created reviews were not assigned to any posts. Check this screenshot hidden link

Because of the Elementor limitation on nested shortcodes, you need to pass through a Toolset content template to use nested shortcodes. Check these content templates:
- Current Post Reviews Form: hidden link
- Current Post Reviews: hidden link
These content templates can be included inside Elementor with a simple shortcode. And the content template will figure out what post is it about:

[wpv-post-body view_template="Current Post Reviews Form"]
[wpv-post-body view_template="Current Post Reviews"]

I used the Toolset "Fields&Text" block to use these nested shortcodes for the form and the reviews:

You can check my test on this post hidden link
For this test, I used a Toolset content template, instead of an Elementor content template. hidden link

Please note this Elementor vs Toolset templates limitation https://toolset.com/course-lesson/using-toolset-with-elementor-page-builder/#limitations-when-using-elementor-and-toolset-templates-together

I hope this helps. Let me know if you have any questions.

#2017611

Thanks Jamal! Everything worked with your great solution 🙂 The only thing I had to do was the clear the cache since I use the WP Asset Cleanup Plugin but now it works like it should!