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!
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
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
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.
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!