Skip Navigation

[Resolved] Make demo post public but keep all other posts private

This support ticket is created 3 years, 3 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: Asia/Karachi (GMT+05:00)

Author
Posts
#1971279

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

#1971723

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#1972313
no access settings.png

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?

#1973159

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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.

#1978543

My issue is not resolved but I will figure it out with a 3rd party. Thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.