Add this code to functions.php
file:
function custom_rewrite_basic() {
add_rewrite_rule('^mp3s/mp3/([^/]+)/playlist/([0-9]+)/?', 'index.php?page_id={PAGE_ID}&songs=$matches[1]&playlist=$matches[2]', 'top');
}
add_action('init', 'custom_rewrite_basic');
function custom_rewrite_tag() {
add_rewrite_tag('%songs%', '([^&]+)');
add_rewrite_tag('%playlist%', '([^&]+)');
}
add_action('init', 'custom_rewrite_basic');
Create a file named my-custom-template.php in your themes root directory as following:
<?php
/**
* Template Name: Music
*/
get_header();
global $wp_query;
echo 'Songs : ' . $wp_query->query_vars['songs'];
echo '<br />';
echo 'Play List : ' . $wp_query->query_vars['playlist'];
// ... more ...
get_footer();
?>
Using this template, create a page and replace {PAGE_ID}
with built page ID in the first code.
Then, go to Setting -> Permalinks and click on Save Changes
.