Jump to content


Photo
WooCommerce for PageLines

WooCommerce product navigation (Next product, Last product option)



Best Answer ellenmva , 07 August 2013 - 08:42 PM

Hi Babs,

 

I was going to suggest using the PostNav Section but that doesn't work with custom post types, just for blog posts. So, I looked and if you are using a child theme or the Pagelines Customize Plugin you can add this code to get pagination -- it will show the product name with an arrow next to it.

 
add_action( 'woocommerce_after_single_product', 'woocommerce_productnav');
function woocommerce_productnav() {
?>
<div class="post-nav fix">
	<span class="previous"><?php previous_post_link('%link') ?></span>
	<span class="next"><?php next_post_link('%link') ?></span>
</div>
<?php
}

If you want the pagination to show above the product, change woocommerce_after_single_product to woocommerce_before_single_product

 

Hope that helps.

 

Ellen

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 bsaul

bsaul

    Advanced Member

  • Members

  • 76 posts
  • LocationKent, UK
  • Country: Country Flag

Posted 18 July 2013 - 05:27 AM

Hello

 

Has anyone managed to get product navigation going on their shop? I want a simple "Next Product" "Last Product" option.

 

Thank you

 

Babs



#2 ellenmva

ellenmva

    Advocate

  • Members

  • 330 posts
  • LocationMassachusetts
  • Country: Country Flag

Posted 07 August 2013 - 08:42 PM   Best Answer

Hi Babs,

 

I was going to suggest using the PostNav Section but that doesn't work with custom post types, just for blog posts. So, I looked and if you are using a child theme or the Pagelines Customize Plugin you can add this code to get pagination -- it will show the product name with an arrow next to it.

 
add_action( 'woocommerce_after_single_product', 'woocommerce_productnav');
function woocommerce_productnav() {
?>
<div class="post-nav fix">
	<span class="previous"><?php previous_post_link('%link') ?></span>
	<span class="next"><?php next_post_link('%link') ?></span>
</div>
<?php
}

If you want the pagination to show above the product, change woocommerce_after_single_product to woocommerce_before_single_product

 

Hope that helps.

 

Ellen



#3 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 14 August 2013 - 02:16 PM

If you still need assistance, please let us know. Otherwise this topic will be closed in 7 days. Thanks! :)



#4 thebastion

thebastion

    Advocate

  • Members

  • 252 posts
  • Framework Version:DMS Latest
  • Country: Country Flag

Posted 11 September 2013 - 07:50 PM

@ellenmva @Jenny I tried the code by inserting it into "content-single-product.php" in my child theme but all I get is errors, also the code does not look like it is even formatted correctly? I also tried adding it into my functions.php but thats even worse.

 

Could you expand please and maybe suggest where this should go.

 

Much appreciated.


Edited by thebastion, 11 September 2013 - 07:52 PM.


#5 ellenmva

ellenmva

    Advocate

  • Members

  • 330 posts
  • LocationMassachusetts
  • Country: Country Flag

Posted 12 September 2013 - 07:18 PM

@thebastion The code goes in your child theme functions.php file. Make sure you copied all the code. Then, if you are getting an error, take a screenshot and post it. 







Also tagged with one or more of these keywords: WooCommerce for PageLines