Tell us what you are trying to do?
I am trying to display a view of a single post (a cartoon image drawn from Cloudinary) in a different way depending on whether the user is a logged-in administrator, or a guest.
1. A logged-in administrator would search for posts using a search facility on the site and on selecting a single post they would click on the link and be taken to a CRED form to edit the post. This is all working well.
2. A guest may find the post thru a Google search and when clicking on the link I want them to be directed to a view showing only the Post Title and the image of the cartoon.
I have it set up this way:
The single post view is controlled by a template called "edit strips" which looks like this:
[toolset_access role="Administrator"][cred_form form='edit-comics'] [/toolset_access]
[toolset_access role="Guest"][wpv-view name="single-cartoon-strip"][/toolset_access]
This works properly for administrators, in they they are directed to the CRED form to edit the post.
Guests are directed to the view - but a random post is displayed.
What have I done wrong??
What is the link to your site? hidden link
Hello,
How do you setup the view "single-cartoon-strip"? Please edit it, you can find the "Ordering" setting, see screenshot:
Ordering.JPG
If you are using random order setting in above view, you will need to change the order setting to something else, for example order by post date.
If the problem still persists, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again
Hello Lou Yang,
I have worked through these steps and the problems remains.
If I set Order By to "random", that's exactly what I get - a random display ...but not the one as indicated in the slug being requested.
Do I need to set a filter that will only display the post that is requested by what is typed in the browser?
Regards,
Doug
====
Which post do you want to display in View's result?
If it is a post specific by post ID, you can add a filter in view "single-cartoon-strip", for example:
Include only posts with the following IDs: 123
See our document:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-id/
Hello Lou Yang,
I am looking to display whichever post is called by a guest to the site. This would most likely be thru clicking on a link from a search engine. So a typical request would be for :
hidden link
where "bob-pass-the-soap" would be the slug of the requested post.
Doug
I have tried the URL you mentioned above, but I can see only 404 error:
Oops! That page can’t be found.
Dose this post "bob-pass-the-soap" exist in your website?
If it exists in your website, how do you setup this post? you will need to make sure that post is view-able for guests.
I'm sorry, but I gave you the wrong URL. I was "out and about" at the time that I replied and I got it wrong. 🙁
Some typical URLs would be as follows:
hidden link
hidden link
hidden link
If you click each of these, you'll see that same comic displayed - even though the URL showing in the browser's address bar is for the comic that you clicked on.
Doug
====
Yes, I can see the problem as you mentioned above: that same comic displayed.
I assume you are going to display the current "comic" post information.
If it is, you don't need that post view (ID 2069), you just need to setup a content template for single "comic" post, see our document:
https://toolset.com/documentation/user-guides/view-templates/
Lou Yang,
I seem to have got lost somewhere in the back and forth. Can I ask the question again in the simplest form that I can?
The custom post type "comic" is displayed in a number of different ways on this site: in various sliders and collections, etc. However, it's the single post view that I'm having trouble with.
I need this single post display to achieve two different things:
1. For guests coming from a search engine (or somewhere else out side of this site), I just need then to see a view of the comic image and maybe a call-to-action button.
2. But for logged-in administrators, I need them to be able to see the image along with the "edit content" form that is associated with the post type. These posts are entered and edited thru a CRED form.
I have Access installed and I had intended to use a conditional display to direct guests and administrators to different "views" of the single post.
1. Is this possible?
2. Am I approaching it correctly?
I had established a content template containing the following:
[toolset_access role="Administrator"][cred_form form='edit-comics'] [/toolset_access]
[toolset_access role="Guest"][wpv-view name="single-cartoon-strip"][/toolset_access]
This worked for the administrators, but for guests, it simply displayed a random post.
can you see what I'm try to do?
Many thanks,
Doug
====
Dear Doug,
Yes, it is possible, and I think you are using correct approach.
For the problem you mentioned above:
Post view "single-cartoon-strip" displayed a random post
So the problem is in that above post view "single-cartoon-strip".
I assume you are going to display a custom image field/featured image of current "comic" post.
hidden link
If it is, you don't need that single post view "single-cartoon-strip" at all, you can try these:
1) Create a new content template "comic-for-guest"
2) Display the custom image field/featured image shortcodes in above content template
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-featured-image
3) Modify this line of your codes from:
[toolset_access role="Guest"][wpv-view name="single-cartoon-strip"][/toolset_access]
To:
[toolset_access role="Guest"][wpv-post-body view_template="comic-for-guest"][/toolset_access]
More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-body
Outputs the content of the current post or renders a content template
If you need more assistance for it, please provide a test site with the same problem, I can setup a demo for you.
Thank you for all of your help with this issue, Lou Yang.
I finally found the basic problem was that I had already created a single post template for the post type "comics" using the Theme Builder in Elementor. I had forgotten to "unassign it".
Once I did that, everything we have discussed in this thread began to work properly. 🙂
Thanks again.
Doug
====
Thanks for the sharing the solution, feel free to create new ticket if there is other new questions.
My issue is resolved now. Thank you!