Skip Navigation

[Resolved] Listing Posts, some with URLs and some without

This support ticket is created 3 years 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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 3 years ago.

Assisted by: Luo Yang.

Author
Posts
#2254975

Tell us what you are trying to do?

Hi. I have 2 CPTs which are related to eachother in many-to-many relationship. Both are created by Toolset. Lets name one CPT1 and the other CPT2. The CPT2 has a custom flat taxonomy (like Tags) which tells the "Type" of CPT2s. For example, the CPT2-1 is a Type1 and the CPT2-2 is a Type2.
I want to create a View in the Single Page of CPT1, in which I list all realted CPT2s. In this View, I want all related CPT2s be listed based on date created. The problem I have is here: I want those CPT2s that are Type1 to be "Post title with a link" in the list, and those CPT2s that are Type2, to be a normal "Post title" (without link).

How can I achieve this? Please help.

Thank you in advance.

#2255211

Hello,

I assume you are going to achieve these:
In the single "CPT1" post, display a post view:
- Query related "CPT2" posts
- in view's loop, display such kind of link:
link text is CPT2s post term "Type2", link to CPT2s post URL

If it is, you can setup that link with HTML codes, for example:

<a href="[wpv-post-url]">[wpv-post-taxonomy type="type" separator=", " format="name" show="name" order="asc"]</a>

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-taxonomy
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-url

#2256583

Hello Lou,
Sorry I didn't understand. Could you please explain in more detail?

#2257175

I have provided the example codes in above answer, if you still need assistance for it, please provide a test site with the same problem, fill below private message box with login details, also point out the problem page/post URLs, I can setup a demo for you