Next/previous post not going in order
-
Hey guys,
I’ve been trying to add next/previous post buttons to my site using the below code:/** * @snippet Add next/prev buttons @ WooCommerce Single Product Page * @how-to Get CustomizeWoo.com FREE * @sourcecode https://businessbloomer.com/?p=20567 * updated code with forum: https://generatepress.com/forums/topic/previous-and-next-buttons-in-woocommerce/#post-637396 * @author Rodolfo Melogli * @testedwith WooCommerce 2.5.5 */ add_action( 'woocommerce_before_single_product', 'tu_prev_next_product' ); function tu_prev_next_product(){ echo '<div class="prev_next_buttons">'; $previous = next_post_link( '%link', '← Previous', true, '', 'product_cat' ); $next = previous_post_link( '%link', 'Next →', true, '', 'product_cat' ); echo $previous; echo $next; echo '</div>'; }
But i’m having two problems:
1) I don’t think the products are being linked to in any discernable order – I want it to be sorted in the order the user has selected, i.e. on the category page you can choose the ordering such as ‘Sort by latest/popularity/price etc.’, but I fear it may be going by posted date2) I can’t see the buttons appearing on some categories, such as in this one https://katecouragemusic.com/product-category/solos/
Can you please advise?
Thanks!
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Next/previous post not going in order’ is closed to new replies.