Skip Navigation

[Resolved] Connected Post Type field not showing in View

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.

Our next available supporter will start replying to tickets in about 1.86 hours from now. Thank you for your understanding.

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)

This topic contains 10 replies, has 2 voices.

Last updated by Waqar 1 year, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2555929

Tell us what you are trying to do?
I have two Custom Post Types:
1. Mitarbeiter (Staff)
2. Klinik (Clinic)

I want a grid with all the "Mitarbeiter"s showing in which "Klinik" they work, like on the single post page here:
hidden link
"Klinik für Allgemein-, Viszeral- und Thoraxchirurgie" is the Klinik (Custom Post Type)

Is there any documentation that you are following?
I read up on several forum posts and internet searches.

Is there a similar example that we can see?
On another page I solved it with a Taxonomy called "Abteilung" but that had other drawbacks.

What is the link to your site?
hidden link
This is the page with alle "Mitarbeiter"s in a View Loop with a Content Template. Unfortunately, it says "No items found" on that page.

#2556397

Hi,

Thank you for contacting us and I'd be happy to assist.

Can you please see if a relationship query filter has been added in the view's settings, as explained in the following guide:
https://toolset.com/lesson-placement/lesson-placements-1729031-1730449/

In case it still doesn't show the related posts, you're welcome to share temporary admin login details in reply to this message.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2556631
views-query-filter-setting.png

Hi Harry,

Thank you for sharing the access details.

The view 'Kliniken Liste' was set with the 'Kliniken that are related to the current Mitarbeiter' option in the content selection settings, which was working for the case of a single 'Mitarbeiter' post page, but not in a wider context, when used from within another view, that was showing all the 'Mitarbeiter' posts.

I've changed that view's settings to 'All Kliniken' option and added a post-relationship query filter, below it, so that it brings the results related to the 'The current post in the loop'.
( screenshot attached )

After this change, this view is working for both cases.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2556739
Toolset__Related-Posttitles-as-list.png

Hi Waqar,

awesome, thanks for your help. Another question: Is it possible to display the related "Kliniken" as a comma-separated list of links? Like this:
View Mitarbeiter of Klinik, Klinik für Anästhesie und Intensivmedizin, Palliativ- und Schmerzmedizin, Klinik für Allgemein-, Viszeral- und Thoraxchirurgie

Thanks
Harry

#2557963

Glad I could help.

To make those post title links appear as a single-line text, you can include the following CSS code in the view's 'Custom CSS' field:


#wpv-view-layout-243-CPID330 .js-wpv-loop-wrapper * {
    display: inline-block;
    margin: 0px !important;
}

#2561333

I was on vacation for a few days, I'll look into this asap. I also had another question, but can't remember right now -_-

#2562243

Please take your time and mark this ticket as resolved once it is confirmed that the code works.

You're welcome to start a new ticket, whenever you have a new question or concern.

#2562249

Thanks Waqar, I had to adapt the code to make it work:

.wpv-view-output [id^="wpv-view-layout-243-"] .js-wpv-loop-wrapper .wpv-block-loop-item, .wpv-view-output [id^="wpv-view-layout-243-"] .js-wpv-loop-wrapper .wpv-block-loop-item > div { /* .view-kliniken-liste  */
    display: inline;
}
.wpv-view-output [id^="wpv-view-layout-243-"] .js-wpv-loop-wrapper .wpv-block-loop-item:not(:last-child) a:after {
    content: " | ";
}
.wpv-view-output [id^="wpv-view-layout-243-"] .js-wpv-loop-wrapper {
	margin-bottom: 1em;
	line-height: initial;
}

Is there a way to display a view without the search by adding an attribute to the shortcode? I couldn't find anything in the documentation here https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view

E.g. something like this:
[wpv-view name="My amazing custom post list" search="nope"]

#2563685

Thanks for writing back and for sharing the code reference. It will prove useful for other users, with a similar requirement.

Yes, it is possible to pass values to views using the shortcode attributes, when calling them through the shortcode 'wpv-view'.

Here is a useful guide on the topic:
https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/

This guide specifically covers the classic/legacy views, but the same logic should also work with the blocks-based views filters too. It is important to note however, that the 'Views' block doesn't support accepting attributes, so even if you've created a view using the blocks editor, you'll have to call it on a page/post through the views shortcode 'wpv-view', in order to pass some attributes.

#2564725

Thanks for the guide. It can't be used to hide the search because it's outside of the loop but I could solve it with some simple CSS.

You may close the ticket, thank you!

#2564741

Thanks for the update and I'm going to mark this ticket as resolved.

You're welcome to start a new ticket, for each new question or concern.