WooCommerce ürün sayfasında, tab menüde bulunan sekmelere tıkladığınızda URL lerin görünmesini istiyorsanız functions.php dosyasına aşağıdaki kodu ekleyiniz. Kodu eklediğinizde domain.com/urun/deneme-urun#reviews şekinde görünecektir.
function wc_direct_link_to_product_tabs() { if( is_product() ) { ?> <script type="text/javascript"> jQuery(document).ready(function($) { if( window.location.hash ) { // Vars var tab = window.location.hash.replace('#', ''); var tab_content = 'tab-' + tab; // Tabs $( 'li.description_tab' ).removeClass( 'active' ); $( 'li.' + tab + '_tab' ).addClass( 'active' ); // Tabs content $( '#tab-description' ).hide(); $( '#' + tab_content ).show(); } // when the tab is selected update the url with the hash $(".tabs a").click( function() { window.location.hash = $(this).parent('li').attr("class").replace(' active', '').replace('_tab', ''); }); }); </script> <?php } } add_action( 'wp_footer', 'wc_direct_link_to_product_tabs', 30 );
Projeniz ile ilgili veya web sitenizde takıldığınız alanlar ile ilgili şimdi teklif alın
WordPress ve WooCommerce İçin Hazırlamış olduğum Eklentiler