Support » Plugin: WooCommerce Expand Tabs » What was my mistake? (Expand all Tabs but Continue Printing Tab Selection Menu)

  • Dear Developer

    I tried to copy the original woocommerce tabs code to the tabs-template.php in order to make the tabs appear again but because i can not read php code i don’t know what i am doing wrong.

    It may be important to mention that i have pasted the code inside the tabs-template.php of the “wc34″ directory. Is this correct or do i need to paste it to another tabs-template.php?

    What happens when i update the expand tabs plugin? Is the code going to be overwritten? Is there a way to secure the code forever?

    Thank you very much for your advice

    ————BEGIN—-I copy this code——-
    if ( ! empty( $tabs ) ) : ?>

    <div class=”woocommerce-tabs wc-tabs-wrapper”>
    <ul class=”tabs wc-tabs” role=”tablist”>
    <?php foreach ( $tabs as $key => $tab ) : ?>
    <li class=”<?php echo esc_attr( $key ); ?>_tab” id=”tab-title-<?php echo esc_attr( $key ); ?>” role=”tab” aria-controls=”tab-<?php echo esc_attr( $key ); ?>”>
    “><?php echo apply_filters( ‘woocommerce_product_’ . $key . ‘_tab_title’, esc_html( $tab[‘title’] ), $key ); ?>

    <?php endforeach; ?>

    <?php foreach ( $tabs as $key => $tab ) : ?>
    <div class=”woocommerce-Tabs-panel woocommerce-Tabs-panel–<?php echo esc_attr( $key ); ?> panel entry-content wc-tab” id=”tab-<?php echo esc_attr( $key ); ?>” role=”tabpanel” aria-labelledby=”tab-title-<?php echo esc_attr( $key ); ?>”>
    <?php if ( isset( $tab[‘callback’] ) ) { call_user_func( $tab[‘callback’], $key, $tab ); } ?>
    </div>
    <?php endforeach; ?>
    </div>

    <?php endif; ?>
    ————END—-I copy this code——-

    ————BEGIN—-I replace this code——-
    if ( ! empty( $tabs ) ) : ?>

    <div class=”woocommerce-tabs wc-tabs-wrapper”>
    <?php foreach ( $tabs as $key => $tab ) : ?>
    <?php if (!isset($tab[‘callback’])) continue; ?>
    <div class=”panel entry-content wc-tab” id=”tab-<?php echo esc_attr( $key ); ?>”>
    <?php call_user_func( $tab[‘callback’], $key, $tab ); ?>
    </div>
    <?php endforeach; ?>
    </div>

    <?php endif; ?>
    ————END—-I replace this code——-

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Diana Burduja

    (@diana_burduja)

    The purpose of the plugin is to remove tabs. You want to use the plugin, but to add the tabs again. Wouldn’t it be easier to simply disable the plugin?

    Yes, if you modify the plugin code directly, it will be overwritten on an update. This is simply how WordPress works.

    The “wc34” stands for the WooCommerce 3.4 version. In the WC 3.5 there were nothing changed in the tabs.php template or in the JavaScript file, therefore there is no “wc35” folder. But if you’re using an older version of WC, then you need to make the changes in the appropriate folder (“wc33” for WC 3.3 version, “wc32” for WC 3.2 version and so on).

    The best way to find out where you need to make the changes is to add a small debug code. For example: write “abc” before the “<div class=”woocommerce-tabs wc-tabs-wrapper”>” code. If there is no “abc” showing up on on the frontend, then it is the wrong file and you need to try the other ones.

    • This reply was modified 5 years, 2 months ago by Diana Burduja.
    Thread Starter orangensaft

    (@orangensaft)

    Hello Mr Burduja

    Many thanks for your fast reply.
    The expansion of the tabs works very well.

    My first idea was to make the product tab button to display as vertical floating buttons positioned at the right side of every product page. The buttons should stay in view while scrolling. But i found out that this is too difficult for me to do, because i do not know how i could make a specific product anchor button only displaying when there is also content inside the product tab.

    My second idea then was to just display the default product tab buttons above the description tab. Our customers shall be able to scroll automatically to the position of the desired product tab. I only would need to make the default product tabs to display above the expanded tabs and make them to work as anchor link buttons.

    After searching i found that somebody else already had the same idea and surprisingly he wrote that he has found a working solution. Unfortunately his solution does not in my case. I could not find an error in the above php code. or could it be that it does not work because i copied the wrong part of the code?

    https://wordpress.org/support/topic/expand-all-tabs-but-continue-printing-tab-selection-menu/

    best wishes
    orangensaft

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What was my mistake? (Expand all Tabs but Continue Printing Tab Selection Menu)’ is closed to new replies.