Skip to content

Instantly share code, notes, and snippets.

@Balachandark
Last active December 17, 2019 08:59
Show Gist options
  • Save Balachandark/bf97201874625a5a8eb5b679ff53ccd0 to your computer and use it in GitHub Desktop.
Save Balachandark/bf97201874625a5a8eb5b679ff53ccd0 to your computer and use it in GitHub Desktop.
Add new markup for navigation
add_action( 'wp', 'remove_astra_woocommerce_action', 11 );
function remove_astra_woocommerce_action(){
if( is_callable( 'ASTRA_Ext_WooCommerce_Markup::get_instance' ) ) {
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'product_navigation_wrapper_start' ), 1, 0 );
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'next_previous_links' ), 1, 0 );
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'product_navigation_wrapper_end' ), 1, 0 );
}
}
add_action( 'wp', 'add_new_navigation_markup' );
function add_new_navigation_markup() {
add_action( 'woocommerce_single_product_summary', 'add_product_navigation_wrapper_start', 1, 0 );
add_action( 'woocommerce_single_product_summary', 'add_woocommerce_product_summary', 1, 0 );
add_action( 'woocommerce_single_product_summary', 'add_product_navigation_wrapper_end', 1, 0 );
}
/**
* Breadcrumb wrapper Start
*/
function add_product_navigation_wrapper_start() {
$nav_style = astra_get_option( 'single-product-nav-style' );
?>
<div class="ast-product-navigation-wrapper <?php echo esc_attr( $nav_style ); ?>">
<?php
}
function add_woocommerce_product_summary() {
if ( ! is_product() ) {
return;
}
?>
<div class="product-links">
<?php
previous_post_link( '%link', '<i class="ast-icon-previous"></i>', true, '', 'product_cat' );
next_post_link( '%link', '<i class="ast-icon-next"></i>', true, '', 'product_cat' );
?>
</div>
<?php
}
/**
* Breadcrumb wrapper End
*/
function add_product_navigation_wrapper_end() {
?>
</div><!-- .ast-product-navigation-wrapper -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment