Skip Navigation

[Closed] How to set grand child posts custom search?

This support ticket is created 4 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
- 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 28 replies, has 3 voices.

Last updated by Minesh 4 years ago.

Assisted by: Minesh.

Author
Posts
#1578399

Hello,

Minesh is on vacation, I have tried the credentials you provided in post:
https://toolset.com/forums/topic/how-to-set-grand-child-posts-custom-search/#post-1570609
It is not valid administrator account.

so I have create a new ticket for the rest questions:
https://toolset.com/forums/topic/split-how-to-set-grand-child-posts-custom-search/

Please provide the credentials in above new ticket.

#1578527

Hi, now I have activated the Super Admin Access to the credentials. You can use this credential for the Split ticket.
Thank you.

#1579249

I assume the original question of this thread is resolved, for the rest questions, please follow up the new ticket.

#1579715

Hi Luo,
if there is any possibility to have child posts custom search into the grand grand parent post, yes, this thread is resolved.

#1579747

But,
I don't know why, in the "– Eventi nella Provincia –" section the posts in the pagination are not show correctly. In the pagination would be displayed 12 posts per page, but in every single pagination sometimes are displayed 1 posts, sometimes 0, sometimes 3, sometimes 8...
Why?

#1580731

We can handle the questions one by one.

For the question:
if there is any possibility to have child posts custom search into the grand grand parent post

I assume we are talking about these post type relationships in your website:
Nazioni -> Regioni -> Province -> Comuni -> Eventi

You are going to do these:
In a single "Nazioni" post, setup a post view with custom search form, to query related "Eventi" posts. See our demo site:
hidden link
section "Search Houses", the dropdown menu "State" and "City", they are also based on two one-to-many relationships:
State-> City-> Property

Is it what you want? If it is, please check our document: "How to filter by related posts"
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/

Please let me know if you need assistance to setup a demo in your website.

#1580785

Ok for the custom search using the relationship dropdown menu.
But,
I don't know why, in the "– Eventi nella Provincia –" section the posts in the pagination are not show correctly. In the pagination would be displayed 12 posts per page, but in every single pagination sometimes are displayed 1 posts, sometimes 0, sometimes 3, sometimes 8...
Why? See the "– Eventi nella Provincia –" section in this URL hidden link

#1580805

Please check the post view "Lista Eventi con Ricerca per Provincia":
hidden link

In section "Loop Editor", you are displaying a child post view insider Views loop:

<wpv-loop>
          [wpv-view name="lista-eventi-comune-per-provincia" cached="off" suppress_filters="true"]
</wpv-loop>

I have changed above codes to display post link shortcodes:

  		<ol>
		<wpv-loop><li>[wpv-post-link]</li>
          [wpv-view name="lista-eventi-comune-per-provincia" cached="off" suppress_filters="true"]
		</wpv-loop>
        </ol>

Test it in front-end:
hidden link
in section "– Eventi nella Provincia –", the pagination works fine, it display 12 items per page.
Can you confirm it?

The problem is in the child post view "Lista Eventi Comune per Provincia":
hidden link
When there isn't "Eventi" posts satisfied the filters, so the child post view outputs an empty div tag, and conducts the problem you mentioned above:
sometimes are displayed 1 posts, sometimes 0, sometimes 3, sometimes 8

For example, you can edit the child post view, in section "Loop Editor", with shortcode [wpv-no-items-found]... [/wpv-no-items-found], display a message: No Eventi posts found, like this:
[wpv-no-items-found] No Eventi posts found [/wpv-no-items-found]

You should be able to see the result of child post view in front-end.

#1580883

Ok,
Then it is not possible to display an organic grand child post type posts section. Because if the parent post type doesn't have related child posts, it displays the "no items display" message, or blanc div if there is no message set. And not aggregate only the existing grand child posts...
I will delete the section from grand child post type posts.

#1583681

Yes, you are right, since there isn't direct relationship between grand-grandparent post type "Nazioni" and child post type "Eventi", and when there there isn't "Eventi" posts satisfied the filters of child post view "Lista Eventi Comune per Provincia", it will conduct the problem you mentioned above.

However, you can consider custom codes, for example:
In a single "Nazioni" post:
1) Create a post view to query "Eventi" posts
2) Use filter hook wpv_query_filter to trigger a PHP function
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
3) in this PHP function, get current "Nazioni" post ID:
https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/
$current_page is used to retrieve data from the current page being rendered. It can be used inside a View loop to obtain data from the page on which the View is being rendered.
4) Use above "Nazioni" post ID to get related "Regioni" post IDs
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
Use "Regioni" post IDs to get related "Province" post IDs
Use "Province" post IDs to get related "Comuni" post IDs
Use "Comuni" post IDs to get related "Eventi" post IDs
Then pass "Eventi" post IDs to post view of step1)
https://developer.wordpress.org/reference/classes/wp_query/#post-page-parameters
post__in (array) – use post ids. Specify posts to retrieve.

It should be able to get all related "Eventi" posts too. please let me know if you need assistance to setup the custom codes.

I have checked the credentials you provided, it is not valid admin account anymore, please check it, thanks

#1587241

Thank you for your reply,
I will try this solution very soon!

#1587699

OK, please let me know if you need more assistance for it.

#1589901

Sorry for the delay in reply,
well, I have removed the super admin to the account because, I don't know why, every time I keep the super admin to the account, I find more changes in codes in Views and Content Templates that generated issues and conflicts, and also, last time, I have found a change in a subsite that was set to "deleted" and it was no longer visible to the users...

Well, I need assistance to setup the custom codes to display "Events" in parent and grand parent posts, etc...

#1592541

Minesh
Supporter

Languages: English (English )

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

Luo is on vacation. This is Minesh here and I will take care of this ticket. Hope this is OK.

I need assistance to setup the custom codes to display "Events" in parent and grand parent posts
==>
As Iunderstand, You want to display Events in parent and grant parent posts but on single posts of your parent and grand parent post - correct? If yes:

Can you share on what parent/grand parent post at what section you want to display the events?

The topic ‘[Closed] How to set grand child posts custom search?’ is closed to new replies.