Skip Navigation

[Resolved] PHP Conditional Tag for Custom Taxonomy created by Toolset

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

Last updated by jamesL-9 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#581349

Hi,

I have created a set of custom taxonomy and term for Woocommerce Product Post Type and I would like to apply Conditional Tags for some of the functions I am hooking into the Custom term Archive page.

The code below is the function I want to add to the Product Term Archive pages and it works as expected

add_action( 'woocommerce_archive_description', 'coffee_archive_description', 15 );
function coffee_archive_description() {
	echo 	do_shortcode('[myshortcode]');
	}

Now I am trying to add conditional tags to the function so it only works on my custom terms created by toolset and not my other Woocommerce Archive pages.

I have tried the conditional tag is_tax() as below but it doesn't seem to work.

if ( is_tax() ) {
add_action( 'woocommerce_archive_description', 'coffee_archive_description', 15 );
function coffee_archive_description() {
	echo 	do_shortcode('[elementor-template id="11881"]');
	}
}

How is Custom Taxonomies Toolset registered in WordPress/Woocommerce?
How can I set a conditional tag, if it is possible?

Thanks in advance

#581525

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - could you please tell me which taxonomy you created and for which terms you would like to display the things conditionally.

Also, where and how you added the code you shared? have you added it to functions.php fiel - if yes, I need to check how you added as it should be added to specific hook.

If you can share all above required information with access would be great to help you further.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#581823

Hi Minesh,

Thanks for the offer but I have managed to bypass the issue by using the !is_shop () conditional tag.