I am working on a plugin where I am trying to create a "archive like" page with permalinks.
Here is what I have so far:
- I've created a query var "experience"
I've created custom SQL selects using - "post_join" and "post_where" hooks
I've created a custom template using the "template_redirect" hook
- I've added custom permalink rules and flushed them
All good so far, the only thing I'm not getting is how I can link to my new archive like page "dynamically".
I can create a static link like mysite.com/experience/id - but this will not work when permalinks are off.
Also I tried to generate the URL like
<a href="' . add_query_arg( 'experience', $id, get_bloginfo('url') ) . '">url</a>
This works when permalinks ar off and also when on, but this not changes to mysite.com/experience/id when they are on. It always remain mysite.com/?experience=id
So what I would like to understand is how can I create those permalinks dynamically, so they will be recognized depending if permalinks are on/off.
Thank you.