Skip Navigation

[Resolved] Need that all category pages that has as parent Woman category shows a views sho

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

Last updated by Waqar 4 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#1776405

Hello, I am picking up this query again:

https://toolset.com/forums/topic/function-to-check-current-product-category-s-parent/

Now I'm doing it mannually, like this:

[wpv-conditional if="('[wpv-taxonomy-archive]' eq 'Sandalias' ) OR ( '[wpv-taxonomy-archive]' eq 'Zuecos' ) OR ( '[wpv-taxonomy-archive]' eq 'Limited Edition' ) OR ( '[wpv-taxonomy-archive]' eq 'Plataformas' ) OR ( '[wpv-taxonomy-archive]' eq 'Zapatillas' ) OR ( '[wpv-taxonomy-archive]' eq 'Flats' ) OR ( '[wpv-taxonomy-archive]' eq 'Accesorios' ) OR ( '[wpv-taxonomy-archive]' eq 'Pretemporada' )"]
[wpv-view name="categorias-mujer"]
[/wpv-conditional]

But as I mentioned initially, I need that all category pages that has as parent Woman category shows a views shortcode, for example for woman shop [wpv-view name="categorias-mujer"]

I want to give you access to the site, please.

This is the layout of the store: hidden link

#1778207

Hi,

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

I'll be in a better position to guide you with this, after seeing how these archives are currently set up in the admin area.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1779031

Hi,

Thank you for sharing the admin access.

I noticed that the code for the "wp_parent_archive_title" custom shortcode is added in the "parent_archive_title" segment but it is not active.
( at WP Admin -> Toolset -> Settings -> Custom Code - https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ )

Please activate that code snippet and let me know if the conditional check added in the "Tienda" layout works.

regards,
Waqar

#1780585

Hi Waqar,

Thanks for your help. I activated the shortcode but is not working in the "Tienda" layout.

I use it like this:
[wpv-conditional if="( ' [wp_parent_archive_title taxonomy='product_cat']' eq 'Woman' )"][wpv-view name="tienda-mujer"][/wpv-conditional]

I deleted it again because if not the shop will not show the products.

I'm not sure if 'product_cat' is ok.

Just to check if we are on same page, does that shortcode check what is the current archive's parent category? For example, you are in Sandalias archive page. Does this say "if Sandalias has as parent category ¨Woman¨ show this view"? Because that's what I need please.

Thanks a lot!

#1783429

Hi,

Thanks for the update.

During testing, I couldn't make the custom shortcode to work to return the title of the parent term, either.

However, using the "wpv-taxonomy-archive" shortcode with the parent attribute worked in the layout:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-taxonomy-archive )

Example:


[wpv-conditional if="( ' [wpv-taxonomy-archive info='parent']' eq '17' )"]
// The parent category is men ( term ID: 17 )
[/wpv-conditional]

[wpv-conditional if="( ' [wpv-taxonomy-archive info='parent']' eq '16' )"]
// The parent category is women ( term ID: 16 )
[/wpv-conditional]

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

regards,
Waqar