Here is a quick snippet that I wanted to do for a long time. The aim is to allow you to create custom URLs to access products page with a specific tab active. By default, when you access a product page, the “description tab” is active by default, but with this snippet you can open the reviews tab (for example) directly from the URL. Useful isn’t it?
To use is it, simply add the tab name after a #, for example: http://mysite.com/my-product-name#reviews
Simple right?
To be able to use this method, simply paste the following code in the file called functions.php in your theme folder:
And guess what? It works no matter the permalinks structure is ;-)
Here is the result:
Leave a Reply
You must be logged in to post a comment.