Skip Navigation

[Resolved] Many-Many Relationship and Displaying of Categories accordingly for post

This support ticket is created 7 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#491067

i have decided to switch it over to a new CPT created from Types, and it seems to be well. however i have another problem and I will describe the scenario here

There are 2 post types that I want to connect together
1) Post (with categories - Deals, News, Insights, Publications)
2) Members

I am connecting the 2 via the many-to-many relationship now, with a CPT - Members Posts
From this, I am able to retrieve the Post that I have associated the member with, and I can retrieve it vice versa.

I would like to do the retrieval of the post, based on a certain category (deals, news, insights, publications), and if available, display the taxonomy as the heading accordingly.

What I want to achieve
1) Get List of Post associated with Member
2) If there are Publications, display the heading "Publications", and show the posts with category Publications under the heading at all, otherwise do not display the heading at all.
3) Do the same for the other categories of post as well

This is what I have tried so far
-Put conditionals at the template view and put the heading manually in the top loop after [wpv-items-found]

[wpv-conditional if="( '[wpv-post-taxonomy type='category' format='slug' id='$post']' eq 'publications' )"]
[wpv-post-link id="$post"] - [wpv-post-date format="F jS, Y" id="$post"]
[/wpv-conditional]

But if there are no associated publications, the heading Publications will still appear, as the query filter still returns posts for the other categories

#491123

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

This is what I have tried so far
-Put conditionals at the template view and put the heading manually in the top loop after [wpv-items-found]
==> What if you try to put heading just BEFORE the shortcode: [wpv-items-found]

#491138

thanks for your reply. the publications heading still appears, as the query filter above still meets the requirements, ie its still a post that belongs to the member, but I am unable to only display in the respective categories.

#491170

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As I understand you want to display posts underneath the category:

For example:
Category 1:
- post 1
- post 2
- post 3
Category 2:
- post 1
- post 2
- post 3
Category 3:

As per above example - you do not want to display "Category 3" as it does not have any posts - correct?

#491221

yup! you are correct

#491228

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please try to follow the steps give with the following link:
=> https://toolset.com/2015/07/how-to-group-posts-by-category/

And once you follow above step, you just need to put your heading name after the shortcode: [wpv-items-found]

That means if items found then dispaly the title otherwise not.

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