wordpress plugin making friendly URLs and accessing variables

I’ve been searching for a couple of days for a particular answer to my question. I have written a custom plugin for wordpress which we will be using on our site. It was easier to make this a custom plugin rather than trying to use or hack existing ones.

As an example, let’s say we are selling cars. My plugin lets us create a new car, upload a photo and write reviews about that car. This is all done through my plugin.

Read More

I now need to integrate that to the existing site using friendly urls.

I’d like domain.com/cars/ford-focus/2234 as the url. that would look like index.php?pagename=cars&model=matched[1]&otherid=matched[2]

also domain.com/category/hatchback would be index.php?pagename=category&cat=matched[1]

Both those urls would call a function and I will display the records on the page.

I am really struggling as to whether I create a page called “cars” and have a [shortcode] or do I handle everything in my plugin and rewrite urls. I have tried all sorts and its just not working. I don’t know if I fully understand the way it works!?

Also – I have tried the route of using custom post types etc, but for our needs it’s not right.

Thanks for any help!!

Related posts

Leave a Reply