Is dynamic URL possible in WordPress

Not completely sure I understand what you mean with that the parameters fall under a page job, but if you mean that different contents are loaded on the same page using javascript / ajax, you could use https://github.com/browserstate/history.js/ to generate the corresponding url for each state. Difficult to say more about how you could implement this without knowing more about what you are trying to do.


UPDATE

I think you should use custom rewrite rules. That is what wordpress uses to create the nice urls, and it has an API to add your own.

First you need to add the tags you need to track, in your case title and job_id. Actually you should probably change title to something like job_title, I am not completely sure title would create a problem, but since it is something in wordpress, it is better to be on the safe side.

I used the following code, you need to add it to your function.php, in your theme.

add_filter('query_vars', 'add_query_vars');
function add_query_vars($aVars) {
    $aVars[] = "job_title"; 
    $aVars[] = "job_id"; 
    return $aVars;
}  

More info: http://codex.wordpress.org/Rewrite_API/add_rewrite_tag

Then you add the rewrite rule, also in functions.php:

add_action( 'init', 'add_rules' );  
function add_rules() {
    add_rewrite_rule('^job/([^/]*)/([^/]*)/?','index.php?page_id=12&job_title=$matches[1]&job_id=$matches[2]','top');
}

You should replace the page_id by the id of the job page
More info: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule.

Once you have saved the file, you need to go to settings -> permalinks and simply save without changing anything. That will make sure your settings are correctly loaded.

You can install the plugin rewrite inspector to see all the rewrite rules applied and check that yours are present.
https://wordpress.org/plugins/rewrite-rules-inspector/

You can install the plugin debug bar to inspect the page and see what rewrite rule is being applied to the page:
https://wordpress.org/plugins/debug-bar/

And here you have more info on rewrite rules in general:
http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/


UPDATE 2

To retrieve the parameters:

if (isset($wp_query->query_vars['job_title'])) {
    $job_title = urldecode($wp_query->query_vars['job_title']);?>
<?php }

Leave a Comment