Support » Plugin: Custom Product Tabs for WooCommerce » Impreza thema

  • Resolved myglass

    (@myglass)


    Can I ask for the codes to be added to my product card because I use non-standard templates in the Impreza theme ?

    • This topic was modified 4 months ago by  myglass.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    @myglass,

    I don’t know what you mean. Can you send me a URL to your product page so I can check out what’s missing?

    Are you missing the tab template? Do you have any tabs showing on your page?

    Thank you,
    Kevin.

    myglass

    (@myglass)

    http://robaks.pl/skasowac/tabs.jpg
    login:dostep
    pass:dostep1

    It does not display because I’m using a template

    http://robaks.pl/skasowac/szablon.png

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    I see. Are you creating your own templates? Where are you getting your custom templates from? Does your theme offer a tab template? Are you looking for the actual PHP code that creates tabs?

    myglass

    (@myglass)

    Page block in the IMPREZA theme – I can add html code

    http://robaks.pl/skasowac/Clipboard02.jpg

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Unfortunately you can’t add tabs with HTML. You’ll need to use PHP code because that’s what drives the tabs template. Does Visual Composer not have a tabs template or a tabs partial or something that you can add into your product page?

    The tabs template is a default WooCommerce template: it is available with all WooCommerce installs.

    myglass

    (@myglass)

    Can I ask for an example of PHP code so that I can add to the card

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Sure – look at the file yoursite/plugins/woocommerce/templates/single-product/tabs/tabs.php

    This is the code in that file that drives the tabs template:

    <?php
    /**
     * Single Product tabs
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/tabs.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see 	https://docs.woocommerce.com/document/template-structure/
     * @package WooCommerce/Templates
     * @version 2.4.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    /**
     * Filter tabs and allow third parties to add their own.
     *
     * Each tab is an array containing title, callback and priority.
     * @see woocommerce_default_product_tabs()
     */
    $tabs = apply_filters( 'woocommerce_product_tabs', array() );
    
    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 ); ?>">
    					<a href="#tab-<?php echo esc_attr( $key ); ?>"><?php echo apply_filters( 'woocommerce_product_' . $key . '_tab_title', esc_html( $tab['title'] ), $key ); ?></a>
    				</li>
    			<?php endforeach; ?>
    		</ul>
    		<?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; ?>

    Cheers,
    Kevin.

    myglass

    (@myglass)

    thx

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.