• Resolved Anthony Froio

    (@anthonyfroio)


    Hello

    I am using the plugin to create a custom tab called “Feeding” and would like the heading inside the tab to be different (Feeding Guidelines).

    Is there a way to change the heading title so it is different from the tab title?

    Thanks in advance for your support!
    Anthony

Viewing 3 replies - 1 through 3 (of 3 total)
  • jpowersdev

    (@jpowersdev)

    Hi @anthonyfroio,

    Here’s an example of changing a specific tab’s title from “Product Tab” to “Other Name”:

    
    add_filter('yikes_woocommerce_custom_repeatable_product_tabs_heading', function( $heading ) {
    	if ( strstr( $heading, 'Product Tab' ) ) {
    		return str_replace( 'Product Tab', 'Other Name', $heading );
    	}
    	return $heading;
    }, 99);
    

    If you need to do this to multiple tabs, you could make an array of mappings and loop through it, like this:

    
    add_filter('yikes_woocommerce_custom_repeatable_product_tabs_heading', function( $heading ) {
    	$mapping = [
    		'First Tab' => 'First Tab Renamed',
    		'Second Tab' => 'Second Tab Renamed'
    	];
    
    	foreach ( $mapping as $key => $value ) {
    		if ( strstr( $heading, $key ) ) {
    			return str_replace( $key, $value, $heading );
    		}
    	}
    
    	return $heading;
    }, 99);
    

    Let me know if that helps,
    Jon

    Thread Starter Anthony Froio

    (@anthonyfroio)

    Hi Jon,

    Thank you so much, this worked for me!

    Have a great day ??
    Anthony

    jpowersdev

    (@jpowersdev)

    Hi @anthonyfroio,

    You’re very welcome!

    Best,
    Jon

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to rename a custom tab heading’ is closed to new replies.