Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Adding class to tabs in php

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #184652
    papdronning
    Participant

    I don’t understand php, so mayby someone can help me here.

    I have the issue that the tabs here: http://proud.dk/product/tom-farm/

    Don’t have classes assigned to them. They should have a class called “reviews_tab” and additional_description_tab” assigned to the li

    I can find this in the theme files:

    function jigoshop_output_product_data_tabs() {       
            
        global $_product;
        
        if ( get_the_content() == '' && ! yiw_if_related() && ! $_product->has_attributes() && ! comments_open() )
           return;
        
        if ( yiw_if_related() )
           $current_tab = '#related-products';
        elseif ( get_the_content() != '' )     
           $current_tab = '#tab-description';
        elseif ( comments_open() )     
           $current_tab = '#tab-reviews';
        elseif ( $_product->has_attributes() )     
           $current_tab = '#tab-attributes';
        
        ?>
        <div id="product-tabs">
            <ul class="tabs">
            
                <?php do_action('jigoshop_product_tabs', $current_tab); ?>
                
            </ul>         
            
            <div class="containers">
              <?php do_action('jigoshop_product_tab_panels'); ?>
            </div>
            
        </div>
        <?php
        
    }
    

    I’m guessing that’s where the action is. But how do I had the classes?

    #184668
    burr
    Participant

    You are talking about the li children of the .tabs ul right?

    Since by the looks that the tabs are generated by the ‘jigoshop’ plugin its probably not recommended to change any of the functions of that plugin because its possible that your changes get overwritten when you update the plugin.

    In saying that you could look for the jigoshop_product_tabs function and manually add your classes into the loop.

    If it were me I would probably target the li with a specific css instead. (If the only reason is for styling)

    For example:

    #product-tabs ul.tabs li  {
    
        /* styles */
    
    }
    #184669
    papdronning
    Participant

    That code was from my theme.

    The thing is, as you may have noticed, that the tabs don’t really work. The content is just lined up underneath each other. And I don’t know how get them to work. I figured it was because they didn’t have the right classes assigned to them. Now I’m beginning to think it’s a .js-problem.

    This is the same theme, but here they work: http://demo.yithemes.com/maya/product/grey-basket-2/

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.