Skip Navigation

[Resolved] Display a loop only in some pages depending of its parent

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.

Our next available supporter will start replying to tickets in about 7.97 hours from now. Thank you for your understanding.

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 1 reply, has 2 voices.

Last updated by Waqar 1 year, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2654585
Captura de pantalla 2023-10-19 184035.png
Captura de pantalla 2023-10-19 184001.png
Captura de pantalla 2023-10-19 183812.png

Hi,
i'm developing a website with Astra PRO and Toolset.
I've created a Custom Post Type named "Servicios" (services in spanish); in services there're parent services and child services what I need is to create a loop of child services into every parent.

For example: I've Copisteria page:
hidden link

Inside Copisteria, you can find fotocopias, encuadernacion, planos so I need to show this loop in copiesteria, but not in the other services.

I have created a custom layout in astra named "Icons for copisteria" and created a shortcode, then I have put this shortcode into de Toolset template for Services, how could I show this shortcode only in the copisteria page?

As attachment you can find some screenshots in order to make it easier to understand aswell as the way I'm developing, maybe is not the correct way to do that.

I hope you can help me or tell me some documentation to read.

Thank you in advance,

Naomi.

#2654939
conditional-block-example.png

Hi Naomi,

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

To conditionally show this content from the shortcode only on a particular post, you can use a conditional block.
https://toolset.com/course-lesson/using-toolset-conditional-block/

As shown in the example screenshot, you can set the conditional block to show the enclosed content, only when the current post ID is equal to the ID of the 'Copisteria' service post.

After that, you can drag the shortcode block inside this conditional block so that it is only shown when the condition is true.

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

regards,
Waqar

#2656871

I resolved my issue in another way. How could I hace done the condition for a child page of a parent? Could that be possible?

Thank you in advance