Skip Navigation

[Resolved] using page and custom post type on same page

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
#2613235
Screenshot 2023-06-06 201826.png

Tell us what you are trying to do?

I am building pages of information that contain a mix of references to (1) other pages containing a group of custom posts (site), or (2) just a custom post (site). When there is a group of sites that go together, I build a page and reference that, other times it is a single item and I reference the custom post "site". I use views to determine what shows up on the group pages. Now i want to build the page that contains the mix using a query. Sorry, no better word than page... Right now i have to add each item by hand because there are too many obstacles to doing it with a query. I use catalog items to identify what goes on a page. I added a plugin to add catalog items to pages. So i want to pull a mix of group (page) items and single (site) items onto the same page. this fails when I try to use a conditional to define what is displayed; pages don't have custom fields like the site does and fields like featured image aren't an option.

am i looking at it wrong? is there another way? otherwise i have to build those pages by hand.

Is there any documentation that you are following? No

Is there a similar example that we can see? No

What is the link to your site? hidden link
the page is actually named Places to Visit

note that only "Hometown of Kathryn Janeway" is a site, all others reference group pages

#2613803

Waqar
Supporter

Languages: English (English )

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

Hi,

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

Based on what you've shared, I'll recommend connecting the items to display on pages, through Toolset's post-relationship feature.

For the sake of clarity, let's define the roles first:

1. Post items that need to be displayed grouped together.
( these post items can either be regular WordPress 'Posts', or you can create a custom post type for this )

2. The regular 'Pages' where these grouped posts are displayed together.

Between these two, you can create a many-to-many relationship, so that you can have as many grouped posts, as needed, with respect to individual pages.

Then on each page, you can use a Toolset View, to show only the related post items.

You'll find useful guides on the topic of post-relationships and how to use them in our documentation:
https://toolset.com/course-chapter/using-post-relationships-on-directory-sites/

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

regards,
Waqar

#2614631

I am following your instructions and I am not using pages, but instead another post type called events. I have a post type called sites, which are individual items, and a post type called events which is where I group the sites using relationships. I would like to be able to merge and display both sites and events on the same page, and the site items in groups (events) should only show the event image and not each related site image. I tried setting the view to allow for multiple post types (site, event) and a conditional container around the image block (like your trainer layout). I can set the conditional for the first as "event image is not empty" and select the event image. I duplicate this block and set the conditional for the second image as "event image is empty" and select the site image. It will not let me test to see if the site image is empty since the field group for sites is not an option on the list; I tried "other post", but it only allowed intermediary (related site) posts -- this is what I am trying to avoid.

So basically, how does one merge two posts (events and sites) on the same page and avoid duplicates?

#2615747

Waqar
Supporter

Languages: English (English )

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

Thanks for writing back.

To suggest the best to achieve this, I'll need to see how these items are set up in the admin area.

Can you please 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.

#2616891
TOOLSET-PLUGIN-ERROR.png

I am so frustrated because your website runs me in a circle and does not allow me to start a new ticket. How in the heck are we supposed to find the support ticket link (why is it not in an easy to see location?) only to have it send me off to a page that logs me out??? Are you guys going out of business?

I am very frustrated with the conditional block editor; it doesn't behave, it has a band across the bottom that blocks the drop-down information so i have to guess and there is no way to clear the conditions in place so i must go to the advanced editor and remove it there. now i am getting these errors and don't know what to do. I like your tools but boy do the UI's suck. I have had to abandon more than one template and restart because of glitches like this.

#2617009

Waqar
Supporter

Languages: English (English )

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

I tried to log in to the website's admin area, but it shows the incorrect password message.

Can you please check the username and password again? I'm setting your next reply as private too.

Also when you were trying to start a new ticket, were you being redirected to some other page or were you seeing any error or warning message? We haven't received any other report about a similar issue, but we can have it investigated, as we get more information.

#2617039
New Ticket screen.png

with respect to the ticket, see the screen shot. That was NOT what i was getting. I was getting the two options: chat with support or contact us. the chat option cycled with no response. the contact us option sent me to a page with no ability to create a ticket and i had been logged out because it had Log In in the upper-right corner.

If this was intentional for maintenance or downtime, please just say so!!

#2617411

How long is it going to take to fix the warnings? These are backend errors so I can't fix them myself.

I get this whenever I try to use the Toolset plugin in wordpress.

I need to keep working on this but am impeded by the warnings. Please help.

If you don't have a way to see the issues with the condition block editor, then i may have to demonstrate from my computer.

#2617585

Waqar
Supporter

Languages: English (English )

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

Thank you for waiting, as I had an unusually busy forum queue after the weekend.

I'm not seeing the errors or warnings related to conditional block(s) on the template 'Template for Events 2'. Looks like you've deleted the old one and now working on this new one.

-----------------------------------------------

> I tried setting the view to allow for multiple post types (site, event) and a conditional container around the image block (like your trainer layout). I can set the conditional for the first as "event image is not empty" and select the event image. I duplicate this block and set the conditional for the second image as "event image is empty" and select the site image. It will not let me test to see if the site image is empty since the field group for sites is not an option on the list; I tried "other post", but it only allowed intermediary (related site) posts -- this is what I am trying to avoid.

So basically, how does one merge two posts (events and sites) on the same page and avoid duplicates?

- You don't need the view that shows both, events and sites on this template for the single events page.

Any data that you need to show from the current event post, can be called in, directly in the template. Whereas any data that you need to show from the related sites can be shown in the loop of the view that shows the related sites.

Currently, the views that are added in the template are correctly set to show the related sites, however, I couldn't fully understand, why two of them are needed.

In case there is some requirement that I'm missing that still requires the use of conditional blocks, please share the details and the exact steps or screencast that leads to the errors.

-----------------------------------------------

> with respect to the ticket, see the screen shot. That was NOT what i was getting. I was getting the two options: chat with support or contact us. the chat option cycled with no response. the contact us option sent me to a page with no ability to create a ticket and i had been logged out because it had Log In in the upper-right corner.

If this was intentional for maintenance or downtime, please just say so!!

- I've checked and there were some maintenance updates scheduled over the weekend, which could have temporarily affected the support forum.

We apologize for the inconvenience caused and you're welcome to start a ticket, for any other questions or concerns.

#2617613
TOOLSET-PLUGIN-ERROR-events.png

Yes, i needed to move forward so i created a new template. I do think this is a bug that you would be interested in tracking down.

the offending template is the event template and it is sitting in the trash. if you reinstate it you will see those warnings show up everywhere in all the templates.

i think what happened is when i edited the condition for the post (event) [see attached screenshot] it did not do what i wanted, so i went back to remove the condition but there was no way to remove it. So i looked in another template for what the original condition was [ (( '' eq '' ))] and used the advanced editor to put that value in. from that point on the warnings came up. Other than that, i still don't see a way with the editor to restore it to the original state (eliminate the condition).

If this is the source of the error, then it is a bug since the system should be self-healing and doesn't recognize its own initial state. Also, a way to reset to no conditions would be important to avoid this in the first place. Also, that editor has issues. There is a band between the buttons (cancel - apply) that blocks the drop-down list so i can't see items in the list. I tried to use the conditional based on a custom field (which never worked) and the list of custom fields is long. So i had to guess where the field was in the drop-down list and try until i got it.
also, the list was so long that a vertical scroll bar showed up which might have helped but when i went to move it down to display more of the drop-down list, the window reverted back to the original window size by collapsing the drop-down list and the scroll bar vanished. so that scroll bar is useless.

I am still struggling with the original issue -- how to merge events and sites on the same report with no duplicates meaning that child-sites for parent-events are not included in the merge, only the parent events + all other sites that meet the condition. I have done this in two views but that means i cannot order the items in a single list.

The business reason for this structure is: events are parents of sites for two reasons (1) it represents a location that has several things to see, so related sites, or (2) it is an episode of a series with related sites as filming locations (which may also be places to see). this is a many-to-many relationship. whether it is a filming location or child is defined in the site field is-child-event or event field is-parent-event, and site field is-film-location. for a particular site it can be any combination of values.

I want to make a list of places to visit but i don't want to include the child-sites only the parent-sites plus any other site (as a singleton) that has the category 'places to visit'. this way i get a full list of places to visit without duplicates. This structure is important because it is not always obvious that some child-sites are located in the same place -- thus the need for a parent grouping. If you navigate to the event template or site template, you will see that both relationships are displayed using conditionals as "film locations" or "places to visit" (event template - parent to child), or "series: season, episodes filmed here" or "belongs to group" (site template - child to parent). this allows the user to navigate freely.

thanks.

#2618441

Waqar
Supporter

Languages: English (English )

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

Thank you for sharing these background details.

Just wanted to let you know that I'm working on this to see if a single view be used to show a consolidated list. Will share the findings, as soon as this testing completes.

Thank you for your patience.

#2619015

Waqar
Supporter

Languages: English (English )

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

Thank you for waiting, while I performed some testing and research.

> I have done this in two views but that means i cannot order the items in a single list.

- To consolidate the results coming from two views, into one view, you'll need to use the following workaround:

1. In summary, you'll need 3 views in total:

a) View 1 will output only the post IDs coming from the first view
b) View 2 will output only the post IDs coming from the second view
c) View 3 will be the actual view, that will be generating the full output, using the post IDs coming from View 1 and View 2.

2. Due to the complexity of this setup, you'll need to use the classic/legacy views editor as something like this is not supported by the blocks-based views editor.

To enable the classic views editor, please go to WP Admin -> Toolset -> Settings -> General and for the "Editing experience" select "Show both the legacy and Blocks interface and let me choose which to use for each item I build".

After that, when you'll refresh the page, the "Views" menu option will become available in the menu WP Admin -> Toolset. From there, you'll be able to create classic editor views.

Our documentation on using the classic editor views is available at:
https://toolset.com/documentation/legacy-features/views-plugin/

I'll encourage you to check out that documentation and try creating some test views to see how the classic editor works. Let me know if you have any questions about how to use it and once you're familiar with it, we'll move to how to structure these 3 views for a consolidated list.

#2620945

This is taking me some time, I had to stop working on this because of a death in the family. I will be back at it soon, please do not close. Thanks.

#2620991

Waqar
Supporter

Languages: English (English )

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

My condolences and please take your time.

The ticket will stay open for a couple of weeks.

#2624805

I already have the two views (Places Visit View, Sites to Visit) and I combined them into a view CombinedPlaceView using the classic editor. Is this the situation where the results could be unexpected? I think all of the views have to be made with the classic editor.

So, I tried to make them using the classic editor (parentevents, singletonsites) -- the sites worked but the events found no items. I couldn't figure that out since I am using the same filters that i used in Places Visit View.

I tried to use the CombinedPlaceView on a page, but the results were weird.

All of the test pages are in the DRAFTS folder, named ...TEST

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