Thanks to this post for the heads up: http://zagar.biz/2011/wordpress-creating-custom-permalinks/
My final code ended up being like this:
In the theme's functions.php file
add_filter('rewrite_rules_array','mycode_add_rewrite_rules');
// Add all rewrite rules here
// ** Remember to Flush Rewrite rules when adding new rules.
// this is done by visiting the Settings > Permalinks in WP admin.
function mycode_add_rewrite_rules($rules){
$newrules = array();
$newrules['tal-dia-como-hoy/([^/]+)/([^/]+)/?'] = 'index.php?pagename=tal-dia-como-hoy&dia=$matches[1]&mes=$matches[2]';
return $newrules + $rules;
}
add_filter('query_vars','mycode_add_rewrite_query_vars');
// Add all slugs so that WP recognizes it
function mycode_add_rewrite_query_vars($vars){
array_push($vars, 'dia');
array_push($vars, 'mes');
return $vars;
}
Then, in the page I created. This is just a regular wordpress page, not a template or anything like that
global $wp;
// connect to your external DB, etc...
if($wp->query_vars["dia"]){
echo "Permalinks are working";
// load up your external data here and display single resource
// if the beard slug doesn't exist, redirect to 404
} else {
// load up whatever you want to display for the index version.
echo "Nothing shows up but it's working anyway";
}
I have to edit the page to make it look good with my brand new permalinks.
This is the page I'll using with this code: http://planeta-beisbol.com/tal-dia-como-hoy/19/04/
The "19/04" part means: 19th of April
I hope this code is useful for everybody
planeta-beisbol.com/tal= tagname? -dia= tagname? -como-hoy/dia= category?/18/mes/04D/M/Y? or would it beplaneta-beisbol.com/tal-dia-como-hoypost name? /diaCPT/Category/Term/18/mes/04D/M/Y Identifying these may help someone better help you with building your Query – David Apr 18 '12 at 9:03