I have custom post type called expert review. I want to show a demo of this post type to logged out users (guests) but I want to keep all other posts of this post type private. I am using toolset access and have given access controls based on user roles but not sure where can I make an exception for a single post. Help appreciated.
Demo post: hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
To add an exception or override, you can use the "wpv_filter_force_template" filter:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_force_template
For example, you can set the "Expert Review" post type to have no access to guests, from Access' post type control settings. And assign a no-access content template so that guests see different content when they try to view those posts.
Once this is working, you can add a custom function to use the "wpv_filter_force_template" filter, to show the regular content template to guests ( and not the no access content template ), only if it is the specific demo post.
( note: you'll find a very relevant example of code snippet with the filter's documentation )
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Waqar,
Thank you for the response. I have two follow up questions:
1) Where do I assign a no content-access template? Is the image I have attached the way to assign a template?
2) If that's the case, then how would this work if I am using elementor post templates. It seems like once I create a post template in elementor, I cannot assign a toolset content template to the same post type.
Would it be something like this -
1) I keep on using the elementor template for "expert reviews"
2) I create a no-content access template and add it to the read column of the expert review access control table.
3) I use the hook you provided to call the elementor template when the user is a guest but wants to access the specific post.
Will that work? Will toolset hook recognize an elementor post id?
Thanks for writing back.
1) Where do I assign a no content-access template? Is the image I have attached the way to assign a template?
> Yes, the attached screenshot correctly shows how to assign a no access Toolset content template.
2) If that's the case, then how would this work if I am using elementor post templates. It seems like once I create a post template in elementor, I cannot assign a toolset content template to the same post type.
> My suggested solution revolved strictly around the case when only the content template from the Toolset is in use. Those suggestions won't work when using templates from Elementor, as the template control logic would be under Elementor and not Toolset.
I remember seeing an advance condition selection option for the assignment of Elementor templates, which also covered conditions for the selection of individual posts and user's login status, but, I'm not 100% sure.
You can consult Elementor's documentation or support team to see if it is possible to assign 'X' Elementor template to all posts in a post type and a "Y" Elementor template to only an individual post in that post type.
My issue is not resolved but I will figure it out with a 3rd party. Thank you!