- This topic has 25 replies, 5 voices, and was last updated 1 year, 6 months ago by David.
-
AuthorPosts
-
July 31, 2018 at 4:37 am #636836Alberto
Hi!
I would like to know if there is any way to place “previous” and “following” buttons on the Woocommnerce product pages, so that you can navigate from one product to another without having to return to the product category page.
Thank you in advance.
July 31, 2018 at 6:18 am #636901DavidStaffCustomer SupportHi there,
You can try this how to:
https://businessbloomer.com/woocommerce-add-nextprevious-single-product-page/
July 31, 2018 at 6:42 am #636920AlbertoHello David! Thank you very much for your reply.
I would appreciate it if you could indicate where I should place those codes within Generatepress.
Thank you very much!
July 31, 2018 at 6:47 am #636924DavidStaffCustomer SupportSo the first code is PHP:
https://docs.generatepress.com/article/adding-php/
If you’re not using a Child theme i would suggest the Code Snippets plugin, a link to which is in the above articleSecond is CSS:
https://docs.generatepress.com/article/adding-css/July 31, 2018 at 8:40 am #637055AlbertoDavid.
I have placed the php code using the Code Snippets plugin. I also placed the additional CSS from Customize> Additional CSS, however the previous and next arrows do not appear on the Woocommerce product page …
I think I followed the steps correctly …
I have to win something more from Generapress?
Thank you in advance.
July 31, 2018 at 9:07 am #637084DavidStaffCustomer SupportAah ok, that code works by skipping through the Product Categories, which it looks like your products don’t have any?
Try adding a base category to some of the products and see if that works.
July 31, 2018 at 9:29 am #637101AlbertoAll the products belong to a category (you can see it from the accordion menu on the right). I have the breadcrumb disabled from Generatepress, although activating it does not make any difference either …
July 31, 2018 at 4:56 pm #637361TomLead DeveloperLead DeveloperThat’s weird.
In your PHP code, find this line:
echo $previous;
On the line above it, do this:
var_dump($previous);
So it should look like this:
var_dump($previous); echo $previous;
That will output some debugging data where the links should show up. Can you share that data with me?
July 31, 2018 at 5:06 pm #637372AlbertoHello Tom.
After placing the code, it now appears, on the left side NULL
July 31, 2018 at 5:30 pm #637396TomLead DeveloperLead DeveloperWeird, so that core WP function isn’t working..
Try this:
add_action( 'woocommerce_before_single_product_summary', 'tu_prev_next_product' ); function tu_prev_next_product(){ echo '<div class="prev_next_buttons">'; next_post_link( '%link', '← Previous', true, false, 'product_cat' ); previous_post_link( '%link', 'Next →', true, false, 'product_cat' ); echo '</div>'; }
August 1, 2018 at 3:36 am #637612AlbertoHello, good morning Tom.
I changed the code I had for this one that you passed me and the previous and next arrows still do not show …
I no longer know what the error may be.
Thank you very much for your help.
August 1, 2018 at 4:31 pm #638201TomLead DeveloperLead DeveloperJust made a small change, can you give it another shot?: https://generatepress.com/forums/topic/previous-and-next-buttons-in-woocommerce/#post-637396
August 1, 2018 at 4:50 pm #638204AlbertoTom.
Unfortunately, it still does not work
August 1, 2018 at 7:54 pm #638286TomLead DeveloperLead DeveloperHmm, this has me stumped! Let me do some testing – I’ll get back to you.
August 2, 2018 at 3:17 am #638497AlbertoOk, thank you very much and I await your response.
-
AuthorPosts
- You must be logged in to reply to this topic.