Created
May 20, 2020 09:12
-
-
Save shubhw12/954f3320ee5eab158684ecb1399eb8ec to your computer and use it in GitHub Desktop.
Show products from the same product category.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('wp' , 'remove_prev_next' , 50 ); | |
| function remove_prev_next(){ | |
| remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'next_previous_links' ), 1, 0 ); | |
| } | |
| add_action('wp' , 'add_prev_next' , 100 ); | |
| function add_prev_next(){ | |
| if ( 'disable' != astra_get_option( 'single-product-nav-style' ) ) { | |
| add_action( 'woocommerce_single_product_summary', 'next_previous_links_custom' , 1, 0 ); | |
| function next_previous_links_custom(){ | |
| 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 | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment