Skip Navigation

[Resuelto] Parent > child filtered loops in Bricks Part 2

This support ticket is created hace 7 meses, 2 semanas. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 9 respuestas, tiene 3 mensajes.

Última actualización por Waqar hace 7 meses, 1 semana.

Asistido por: Waqar.

Autor
Mensajes
#2692073

OK, not one to ever give up…

I looked over the documentation again. More on that in a minute.

I went back to basics and so far the following will return all prints in the database:

return [
'post_type' => 'print', //e.g. faculty
'posts_per_page' => -1,
'meta_query' => array(
array(
'value' => get_the_id()
),
)
];

I feel I am very close. All I need is a way to filter this on the relationship between the two Years and Prints.

Looking through the documentation, I need to determine where my orginal relationship was set up because there are three variants.

• The original legacy.
• Laegacy relationships that subsequently got converted.
• The new way.

I am pretty sure tha the original relationships were created around 2018. So I need to determine was this in legacy times or in the new era?

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#wp_query-argument-for-querying-by-related-posts

#2692198

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As you can see with the "changelog" page - Types 3.0 was released in May 2018 with "Completely rewritten post relationships:":
- https://toolset.com/download/toolset-types/#changelog

if you are not sure - you should try to use both variant of post relationship and check which works for you. As you can see with the doc:
- https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/


Please keep in mind that code 'relationship' => array( 'writer', 'book' ) will work only with relationships that have existed before the migration. If you can use the relationship slug instead of array( 'writer', 'book' ).

You can either use post type slug:

'relationship' => array( 'writer', 'book' ) 

OR if you have new relationship or migrated post-relationship then you should use relationship slug:

 'relationship' => 'post-relationship-slug'
#2692205

Thanks Minesh,

I'll keep pegging away at this for a while. I'll get back to you next week if I need further assistances.

I have to figure out if I need to use the Tooloset code in some sort of function that returns a variable, that function then being called from the 'key' => 'related-field', part of the code that does work. I'm not sure if thatis even feasible or does the code need to be exclusively the Toolset version.

I did a quick snoop through Way Back Machine and I think my rebuild with Divi and Toolset predates varsion 3.0 to some time in 2017.

I will keep plugign away at it.

#2692238

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Ok fine - thank you.

#2692467

I'm going tho throw this up on the Bricks forum. Someone there might have pointers to how this might work.

#2692600

Hi Stephen,

Thank you for this update and let us know if you have any follow-up questions.

For a new question or concern, you're welcome to start a new ticket.

regards,
Waqar

#2692790

Hi Waqar,

Thanks for you patience. It looks like it may take a whle down in the weeds of the documentation before I work this out. I have dropped in the scenario on the Bricks Forums and I might get lucky with help there.

I note that the Toolset documentation is quite scattered. The links provided by Minesh are not something that are easily down through the site navigation. From one of the links provided I was able to use the breadcrumb:

Home » Documentation » Customizing Sites Using PHP » Post Relationships API

From this I see Customizing Sites Using PHP which links on to a lot of useful documentation that is potentially useful in the future.

Not sure if prioritising Blocks documentation over this is useful for us who run into more invovled use cases everyday.

#2693544

Thank you for sharing this Stephen and you've raised a good point.

I'll pass on this feedback about the documentation, internally.

#2693569
Screenshot 2024-04-22 at 8.51.29 a.m..jpg

Hi Waqar,

Much appreciated. I think there is merit in seeing an improvement in the documentation. I would even go as far as saying that a YouTube channel dedicated to many of the complex use cases that we see solved in the support tickets would be a boon for Toolset.

As it is I am not sure how serious the proprietors of Toolset are in where it is going into the future. To this end I have looked closely at alternatives and none seem to match the span of possibilities that can be achieved with Toolset. As well as this, having tested convesion of some of my CPT's, custom fields and relationships, to something like ACF, all is not easily replicated.

The Blocks implementation was something that couldn't be ignored but ultimatley it's the Gutenburg underpinings of the blcok editor that fails many third party software vendors trying to mould it to something that can be used broadly, which is why the old school Toolset Types and Views is valuable for many of us and I think in this respect there is plenty of life in the old dog.

Looking to documentation and a YouTube channel for education, on my own site there are some complex configurations of views via partial templates. In this example, if you scroll down the page there is a view that show the sibling prints of the print in the the post instance:

enlace oculto

From memeory I had to tease out the solution to this via Toolset support, the solution being a view, filtered on the the parent relationship and then place in a templated before insertion in the main post template. The twist was the adition of the following into the shorcode to make it work:

item="@print-year_print.parent"

print-year_print being the relationship slug and .parent being some sort of appendix instruction?

Final result: [wpv-post-body item="@print-year_print.parent" view_template="year-prints"]

I don't mind having to do this type of shortcoding. It's worth it for the final result. What's stranhe is that, having scoured the Toolset webisite, I can't find this solution documented.

Also in views querying filter there are many options, see screenshot. I would love to see all the great things that some of the other options afford?

I am seeing great education around the Bricks Builder and much of this is via YouTube. I think that this is the wayto go to espose what great software can do.

#2693820

Again, thank you for sharing the feedback about the inclusion of more video tutorials. I've made a note of that too, for internal sharing.

For the 'item' attribute usage, you'll find this documentation guide useful:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
( it is linked in our documentation on Views shortcodes: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/ and Types Fields API: https://toolset.com/documentation/customizing-sites-using-php/functions/ )

#2693829

Thanks Waqar,

Much appreciated. I'll look through those docs and see if there any useful implementations that I can use in future projects.

I am sure there are plenty of useful configurations that we are just not aware of. Having video run throughs of these would be of great value to Toolset users.

I'll close the ticket now. I'll continue to see if I can find php queries that will work in Bricks. The beneift of these, diractly in Bricks is that you don't need to leave the Bricks workflow and, you can style the whole view card with BEM directly with Brick's classs first setup

In the meantime I still have my views that do the job as well. Because Bricks has a dynamic root selector for cards you can still apply BEM from the wrapping div around the Toolset view.