Created
September 7, 2017 16:06
-
-
Save thinhbg59/a860ffea44e6f856f413f5f465688ddd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function otff_add_rewrite() { | |
$url = home_url(); | |
$page_id = 542; | |
if ( $page_id > 0 ) { | |
$link = str_replace( $url, '', get_permalink( $page_id ) ); | |
$link = trim( $link, '/' ); | |
add_rewrite_rule( "$link/([^/]+)/page/?([0-9]{1,})/?$", 'index.php?page_id=' . $page_id . '&demo_rw=$matches[1]&paged=$matches[2]', 'top' ); | |
add_rewrite_rule( "$link/([^/]+)/?$", 'index.php?page_id=' . $page_id . '&demo_rw=$matches[1]', 'top' ); | |
} | |
add_rewrite_tag( '%demo_rw%', '([^/]+)' ); | |
} | |
add_action( 'init', 'otff_add_rewrite' ); |
Author
thinhbg59
commented
Sep 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment