mercredi 20 mars 2019

How to add php if condition in this snippet

Can anyone modify the following code with an if condition to do the followings:

if the tab named "uwa_auction_bids_history" exists then the reordering of the tabs to be done as is, but if it doesn't exist, only the first 2 tabs to be reordered ("description & additional_information" ) It should be a basic if/else condition to be added to this snippet but I have no php knowledge so I need a kind man's help...

Thanks!

/**
 * Reorder product data tabs
 */
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {

    $tabs['description']['priority'] = 5;           // Reviews first
    $tabs['additional_information']['priority'] = 10;           // Description second
    $tabs['uwa_auction_bids_history']['priority'] = 15; // Additional information third

    return $tabs;
}

Aucun commentaire:

Enregistrer un commentaire