Sunday, May 31, 2015

Wordpress create url with custom params and custom template

1) Place following on functions.php file

function add_rewrite_rules($aRules) {
    $aNewRules = array('newcustomtemplatepage/([^/]+)/?$' => 'index.php?pagename=newcustomtemplatepage&user=$matches[1]');
    $aRules = $aNewRules + $aRules;
    return $aRules;
}
add_filter('rewrite_rules_array', 'add_rewrite_rules');

2) Save paramalinks on backend side (Settings -> Permalinks -> Save Changes)

No comments:

Post a Comment

Please mention your comments.......