Home › Toolset Professional Support › [Resolved] Displaying brother pages don't work
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)
This topic contains 14 replies, has 2 voices.
Last updated by Waqar 1 year, 2 months ago.
Assisted by: Waqar.
Hello, this is my website structure (categories - subcategories - landing pages):
_________________________________________________________
----Screwing of furniture
>Residential furniture
>Office furniture
>Children's furniture
>...
----Renovation of furniture
> Antique furniture restoration
>Furniture restoration
>Furniture repair
>...
----Customized furniture
>Wardrobes
--Sliding wardrobes with mirrors
--Corner wardrobes
--Alcove wardrobes
--Bedroom wardrobes
--Cabinets for the entrance hall
--Cabinets for children's rooms
--Office wardrobes
>Racks
--Bookcases for the living room
--Bookcases
--Racks for rooms
--Office racks
_________________________________________________________
1) First question: I need help to understand how best to create such a website. What to use CPT for, when to use categories and when to use relationships?
2) Second question: The idea is that siblings of one main category should only display on pages related to that category.
For example: the 'Residential furniture' landing page should have a section with related services containing 'Office furniture' and 'Children's furniture'. The children of other categories, such as "Furniture restoration" or "Furniture repair ", for example, should not appear in this section on the 'Residential furniture' landing page.
So far I have created 3 CPTs for "---- Main category", "> Subcategory" and "-- Landing page". I have created a separate content template for each of these CPTs (3 content templates in total).
Unfortunately there is no way to create a sibling relationship in your plugin.
When I select in the View block the query filter "Filter by post relationship or repeatable fields group owner" and then select parent-child relationship and check "The current post in the loop" box, it displays that the list is empty (even though there are pages created with parent-child relationships).
Your help is really appreciated!
Hi,
Thank you for contacting us and I'd be happy to assist.
1) First question: I need help to understand how best to create such a website. What to use CPT for, when to use categories, and when to use relationships?
- The approach that you've used to connect 3 CPTs for each hierarchal level makes sense. Independent multi-level filtering like this wouldn't have been possible through the taxonomy/categories.
2) Second question: The idea is that siblings of one main category should only display on pages related to that category.
- The steps that you've used for the relationship query filter should produce some results. To troubleshoot why it is generating the empty list, I'll need to see how these involved elements and the view are set up in the admin area.
Can you please share the temporary admin login details along with the link to the page where you've used this view?
Note: Your next reply will be private and it is recommended to make a complete backup copy before sharing the access details.
regards,
Waqar
Thank you for sharing the access details.
I've reviewed the website's setup and couldn't exactly relate the CPT items with what we've previously discussed. That is most likely due to the names being in the 'Polish' language.
Here is what I understand:
These are the custom post types that you've registered:
- Główne usługi ( Main services )
- Usługi docelowe ( Target services )
- Gł. usługi (meble) ( Main services (furniture) )
- Usługi pośrednie ( Indirect services )
I'm going to use the English names for this discussion, for clarity.
And here are the one-to-many relationships that are set between these post types:
- Main services -> Indirect services
- Indirect services -> Target services
Can you please let me know among these post types, which one is going to be treated as the 'Landing Pages'?
Please also share a link to an example page where you'd like to show the related data through a view, but it is showing an empty list.
1) Relationships & categories
Here's the answer:
-The main categories are CPT "Main services."
-Subcategories are CPT "Indirect services."
-The landing pages are CPT "Target services."
I created two categories of main services - "Main services" and "Main services (furniture)" because:
- "Main services" will only have landing pages ("Target services").
- "Main Services (Furniture)" will have subcategories ("Indirect Services"). These subcategories will have landing pages, ("Target Services")
I don't know if this solution makes sense, but this is the only solution I came up with. I am open to suggestions from your side, as I would like to avoid creating two different CPTs for the main services. Only the "Main services" CPT should remain.
2) The View
As for the question related to the View not working, here is one of the pages that is not working properly: hidden link
This page uses a content template called "Templatka - pośrednie usługi".
The sister pages are: "Konserwacja antyków" ("Indirect service" CPT as for now) and "Odnawianie mebli" ("Indirect service" CPT as for now), and the main category is "Renowacja mebli" ("Main categories" CPT).
I'm using the phrase "as for now" because I'm chasing time and need to finish this website as soon as possible. The "Konserwacja antyków" and "Odnawianie mebli" pages should be the landing pages, but I was unable to find a solution on how to do that, so instead of "Target services", I added them to "Indirect services".
Thank you for sharing these details.
Part 1:
> I would like to avoid creating two different CPTs for the main services. Only the "Main services" CPT should remain.
- I also don't like the idea of using two different CPTs for the same thing (Main services). This will become very complicated to deploy and manage, in the long run.
For structural consistency, you can add a generic or default 'Indirect services' term, that will be used for the 'non-Furniture' main services, where an actual sub-category doesn't exist.
Depending on what sounds better, you can use a sub-category term name like 'General', 'Default' etc.
Part 2:
Because you're working on your website, I haven't made any changes to your website.
Instead, I've created a simple demo website, to show you how a view can be used to show sibling landing pages (Target services).
I'm going to share the admin access details of this demo website in a private reply, separately.
This demo website has the same CPT and relationship structures as your website and I've added some demo posts in these post types too.
I'd like you to focus on the content template named 'Ct for Target services' and the Target service named 'Target service 1'.
It has the parent Indirect service named 'Indirect service A', which has two children:
- Target service 1
- Target service 2
I created a view named 'View to show related Target services' in this content template and set a relationship filter that shows results based on the shortcode attribute 'wpvrelatedto':
( screenshot: hidden link )
Select posts in a Indirect services Target services relationship that are related to the Post with ID set by the shortcode attribute wpvrelatedto.
eg. [wpv-view name="view-name" wpvrelatedto="123"]
After creating this view, I included it in a hidden container block, because we can't use it as it is.
This relationship filter tells the system to bring only those posts which are related to the parent post, whose ID has been provided through the shortcode attribute 'wpvrelatedto'.
We can get the related parent post's ID through the item attribute in the 'wpv-post-id' shortcode, like this:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id )
( ref: https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/ )
[wpv-post-id item='@indirect-service-target-service.parent']
Note: the use of target relationship slug 'indirect-service-target-service', which you'll change in your website's case.
And the last step was to call that same view again in the content template, but this time through the 'wpv-view' shortcode, because we can't pass a shortcode attribute, through the view block.
You'll find this combined shortcode, in a 'Fields and Text' block at the bottom:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view )
[wpv-view name="View to show related Target services" wpvrelatedto="[wpv-post-id item='@indirect-service-target-service.parent']"]
So, in summary, I used the view block to create a new view and then hid it, through the container block.
But then used the shortcode method to call/load it again, because, I needed to specify the target parent post, through the shortcode attribute.
I hope this helps and please let me know if you have any follow-up questions.
/************ 1) First point ************ /
Could you explain to me how the relationship between "Main Services", "Indirect Services" and "Target Services" should look like, if I add an "Indirect Service: [General]"? Should I then create one indirect service for each main service? E.g. "Indirect service: [General - screwing of furniture]" and "Indirect service: [General - renovation of furniture]"?
/************************************************/
/************ 2) Second point ************ /
Although everything looks as it should, unfortunately something doesn't add up, because the "Target service 3" page, which is not in relationship with the other "Target services", displays a list that includes "Target service 1" and "Target service 2".
It seems to me that you have made a mistake somewhere. Rest assured, it happens to the best of us! 🙂
(screenshot 1: hidden link)
(screenshot 2: hidden link)
/************************************************/
/************ 3) Third point ************ /
In fact, the whole structure is much more complex than what I presented above. I simply had a problem with such a "basic" structure and thought that this ticket would solve all the other problems and questions.
However, this is not the case, so I will send a more extensive outline of the structure in my next message. I would like you to take it into consideration.
/************************************************/
/************ 3) Third point - STRUCTURE ************ /
"----" is the main service
"--" is the indirect service
">" is the target service
"<name>" is, in a sense, an overrading/overarching indirect category <------------------------------- IMPORTANT
----Screwing of furniture
>Residential furniture
>Office furniture
>Children's furniture
> ......
----Renovation of furniture
>Restoration of antiques
>Restoration of furniture
>Repair of furniture
> ......
----Customised furniture
<Types of furniture> <------------------------------- IMPORTANT
--Wardrobes
>Mirrored sliding door wardrobes
>Corner cupboards
>Leading edge wardrobes
>Wardrobes for bedrooms
>Wardrobes for the hall
>Wardrobes for children's rooms
>Office cupboards
--Racks
>Bookcases for living room
>Bookcases
>Bookcases for the room
>Office bookcases
-- ......
> ......
<Furniture by room> <------------------------------- IMPORTANT
--Kitchen
>Kitchen worktops
>Fronts for kitchen cabinets
>Kitchen drawers
>Kitchen tables
>Kitchen chairs
>Kitchen shelves
>Kitchen cupboards
>Kitchen barstools
--Dining room
>Dining room tables
>Dining room chairs
--Bathroom
>Bathroom cabinet tops
>Fronts for kitchen cabinets
>Bathroom doors
>Bathroom drawers
>Bathroom cabinets
>Cabinets for washstands
-- ......
> ......
---- ......
/************************************************/
As you can see, it's a very sophisticated structure that is optimised for SEO. If you can do something like this in Toolset, you can do anything! 🙂
Another problematic issue is that some of the main services are split into further overarching indirect categories that will NOT have their own pages (e.g. "<Types of furniture>" and "<Furniture by room>").
Although there will be one CPT for all target services, the relationships are more complex.
If I display sister pages for "Indirect service: [Wardrobes]", only services from under "<Types of furniture>" should display.
If I display sister pages for "Indirect service: [Kitchen]", only services from under "<Furniture by room>" should display.
/************ 3) Third point - QUESTIONS ************ /
1) What is the best course of action in such a case?
2) Should I create a fourth CPT, which I will call, for example, "Uber Indirect services"?
3) Should the structure then look like this: "Main Services" -> "Uber Indirect Services" -> "Indirect Services" -> "Target Services"?
4) Should I then create "Uber indirect services: [Uber general - Screwing of furniture]" and "Indirect services: [General - Screwing of furniture]" for each service?
5) Is there a simpler way to do all this?
/************ 1) First point ************ /
My original recommendation was to use one generic 'Indirect services' level item for cases where one doesn't exist.
For example, on the demo website, I've added these 'Indirect sercvices' items:
- Indirect service A
- Indirect service B
- Indirect service C
- Indirect service general
This last item is the generic entry that can be used in between connections, where one doesn't exist naturally.
The idea is to maintain the 3 level hierarchy and I have another suggestion, that I'll share when covering point 3 about the structure
/************************************************/
/************ 2) Second point ************ /
Although everything looks as it should, unfortunately something doesn't add up, because the "Target service 3" page, which is not in relationship with the other "Target services", displays a list that includes "Target service 1" and "Target service 2".
It seems to me that you have made a mistake somewhere. Rest assured, it happens to the best of us! 🙂
(screenshot 1: hidden link)
(screenshot 2: hidden link)
Good catch. The reason, that view shows all the target services is because there is no parent post set for that post 'Target service 3'.
I've wrapped the shortcode of that view inside the conditional block, that only loads the view, if the parent post's ID is not empty:
[wpv-conditional if="( '[wpv-post-id item='@indirect-service-target-service.parent']' ne '' )"] [wpv-view name="View to show related Target services" wpvrelatedto="[wpv-post-id item='@indirect-service-target-service.parent']"] [/wpv-conditional] [wpv-conditional if="( '[wpv-post-id item='@indirect-service-target-service.parent']' eq '' )"] No siblings exist [/wpv-conditional]
The second conditional block shows the text message when the parent post's ID is empty.
You can read more about the use of conditional statements from this guide:
https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/
/************************************************/
/************ 3) Third point - STRUCTURE ************ /
Reading these additional details about the structure, I'm now more inclined towards the idea of using custom taxonomies, rather than custom post types.
( especially due to categories that will not have the landing pages of their own )
Here is what I have in mind:
Custom Post Types:
1. Landing Pages
Custom Taxonomies:
1. Furniture Services (hierarchal):
Terms structure:
( each '-' represents the hierarchy level )
- Screwing of furniture
-- Residential furniture
-- Office furniture
-- Children's furniture
- Renovation of furniture
-- Restoration of antiques
-- Restoration of furniture
-- Repair of furniture
2. Types of furniture (hierarchal):
Terms structure:
( each '-' represents the hierarchy level )
- Wardrobes
-- Mirrored sliding door wardrobes
-- Corner cupboards
-- Leading edge wardrobes
-- Wardrobes for bedrooms
-- Wardrobes for the hall
-- Wardrobes for children's rooms
-- Office cupboards
- Racks
-- Bookcases for living room
-- Bookcases
-- Bookcases for the room
-- Office bookcases
3. Furniture by room (hierarchal):
Terms structure:
( each '-' represents the hierarchy level )
- Kitchen
-- Kitchen worktops
-- Fronts for kitchen cabinets
-- Kitchen drawers
-- Kitchen tables
-- Kitchen chairs
-- Kitchen shelves
-- Kitchen cupboards
-- Kitchen barstools
- Dining room
-- Dining room tables
-- Dining room chairs
- Bathroom
-- Bathroom cabinet tops
-- Fronts for kitchen cabinets
-- Bathroom doors
-- Bathroom drawers
-- Bathroom cabinets
-- Cabinets for washstands
/************************************************/
In this newly proposed section, you'll be able to add as many landing pages as needed, under the CPT 'Landing Pages' and will be able to segment them through the respective taxonomies. This will avoid duplication and the multiple taxonomies will allow you the flexibility to have different levels of hierarchies, under each segmentation/categorization.
In the previously suggested setup, you'll have to maintain exactly 3 levels of hierarchies and you can't have less or more than that.
I hope this makes sense and let me know if you have any follow-up questions.
I will read your answer in detail tomorrow, as I have been short of time recently. Thank you for your help so far!
Please take your time and glad I could help!
/************ 1) First point ************ /
Question 1.1: If I decided to keep the 3 or 4 level structure and use one general Indirect Service [Indirect Service - General] for all main services and target services, how would the relationship between these services look like?
Question 1.2: Would I then be able to create a custom View displaying, for example, the target services for a particular main service, if the Indirect Service is the same for most of them?
/************************************************/
/************ 2) Second point ************ /
Thank you for the clarification!
/************************************************/
/************ 3) Third point ************ /
Question 3.1: How should I then display services from other taxonomies on the pages of one taxonomy? How can I display on the page of a specific service, related services that are in another taxonomy?
--> In the taxonomy structure you have proposed, you have forgotten the main category "Customised furniture", which is on a par with "Screwing of furniture" and "Renovation of furniture".
--> The taxonomy page for e.g. "Customised furniture" - like the landing pages - is supposed to have a list of related services with links to "Screwing of furniture" etc.
Question 3.2: Should I then create separate pages for each taxonomy? Will I be able to use the 'Content Template' for this and use it on all taxonomy pages?
Question 3.2: Why do you think that in the previous setup I will have to maintain 3 levels of hierarchy and cannot have more or less? What is stopping me from adding a 4th level that will be above "Indirect Services"?
/************************************************/
/************ 1) First point ************ /
Question 1.1: If I decided to keep the 3 or 4 level structure and use one general Indirect Service [Indirect Service - General] for all main services and target services, how would the relationship between these services look like
Question 1.2: Would I then be able to create a custom View displaying, for example, the target services for a particular main service, if the Indirect Service is the same for most of them?
- I'm going to combine the answers to both of these questions.
The rule of thumb is to create an interconnection mid-level 'Indirect services' item, for the relationships where one doesn't exist.
But also remember that each 'Indirect services' item can be upwards linked to only a single 'Main service' item.
( because it is one-to-many relationship )
So, I will use a single generic 'Indirect service general' item, as long as I need to connect to only a single/particular 'Main service' item.
But, if I need it for more than one 'Main service' item, then I would definitely create multiple general 'Indirect service' items (i.e. one for each 'Main service' item ).
/************************************************/
/************ 3) Third point ************ /
Question 3.1: How should I then display services from other taxonomies on the pages of one taxonomy? How can I display on the page of a specific service, related services that are in another taxonomy?
- In this custom taxonomy approach you won't be able to automatically define the relationships for the related services, because taxonomies don't allow that.
What you'll be doing is that you'll create a view that will be set to accept target taxonomy slugs through the shortcode attribute ( ref: https://toolset.com/forums/topic/displaying-brother-pages-dont-work/#post-2650119 ).
This way you'll be able to use the same view to show the related services on the landing pages. And by changing the shortcode attribute values on individual landing pages, you'll be able to specify which are the related services/taxonomy, for that individual landing page.
--> In the taxonomy structure you have proposed, you have forgotten the main category "Customised furniture", which is on a par with "Screwing of furniture" and "Renovation of furniture".
--> The taxonomy page for e.g. "Customised furniture" - like the landing pages - is supposed to have a list of related services with links to "Screwing of furniture" etc.
- Of course, you and the client know the requirements better than me, but here is my take on "Customised furniture".
When I reviewed the list/structure that you shared, I saw a pattern where the landing pages, need to be categorized based on these 3 clear paths:
1. Whether it is about a furniture-related service (hence the 'Furniture Services' taxonomy )
2. Whether it is about a specific type of furniture item (hence the 'Types of furniture' taxonomy)
3. Whether it is about a specific furniture that is used in a room type (hence the 'Types of furniture' taxonomy)
In my proposed example structure, I couldn't think of how the 'Customised furniture' part fits in. But, if it is needed, you can either include it as an item in any one of the above-mentioned taxonomies or include another path of its own by a fourth custom taxonomy 'Customised furniture' and add terms under it as needed.
Question 3.2: Should I then create separate pages for each taxonomy? Will I be able to use the 'Content Template' for this and use it on all taxonomy pages?
- You'll not be creating separate pages for each taxonomy or taxonomy term. You'll be creating items/posts under the custom post type 'Landing pages', as needed, and then tagging/categorizing them based on the defined custom taxonomies/paths.
Question 3.2: Why do you think that in the previous setup I will have to maintain 3 levels of hierarchy and cannot have more or less? What is stopping me from adding a 4th level that will be above "Indirect Services"?
- Maintaining 3 levels of hierarchy is not important. Maintaining "fixed" levels of hierarchy is important though.
You can include 4th, 5th, or even more levels of hierarchies, but then they'll need to be maintained across all items without exceptions and not just for some.
In that approach, we'll be using predefined views or methods to call for the items that are sitting exactly at the next/adjacent level (upwards or downwards) of the relationship hierarchy.
Here is an example of how a consistently maintained calls for related items will look like:
"Show the related parent of the related parent of the related parent"
Here is how it will look like when exceptions are introduced:
"Show the related parent of the related parent but see if the current item is 'X', then stop at this level, and if not show related parent of the related parent".
Now this will not only add complexity in terms of deployment/setup but will also have a negative performance impact because we're introducing conditions in between to compare the target items and then treating them differently.
/************************************************/