• Hi,

    I have created a custom child theme based on Genesis. Currently the wordpress permalink structure is set as https://www.mydomain.com/sample-post/.

    I have created a page called Gallery that uses a page template called ‘gallery.php’. In this page template I simply display a selection of product images.

    Currently I use GET data to pass the product id to the page template e.g. https://www.mydomain.com/gallery/?pid=165 however I would like the product gallery url to be more like the product post url and include the name of the product instead of the GET data e.g. https://www.mydomain.com/gallery/my-sample-product

    Can someone point me in the right direction as to how I can get the page template working with this new url structure instead of GET data.

    Many thanks,

    big_s.

Viewing 1 replies (of 1 total)
  • Thread Starter big_s

    (@big_s)

    Seems the solution involves adding a rewrite rule within wordpress. I have tried the following but alas it doesnt work:

    add_action( 'init', 'product_gallery_rewrite_rule' );
    function product_gallery_rewrite_rule () {
    	add_rewrite_rule( '^gallery/([^/]*)/?', 'gallery.php?pslug=$matches[1]', 'top' );
    }

    Anyone any ideas why this isnt working? I havent explicitly flushed the rewrite rules but have visited the permalinks page a few times and cleared caches etc.

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Change from GET to permalink style URL’ is closed to new replies.