Give page theme custom Permalink 404
-
Hello,
I want to change the perma link on a page theme basis.
This is what i’ve got so far in my functions.php://Change permalink to subject function change_permalink_themebasis( $post ) { $template = get_post_meta( $post->ID, '_wp_page_template' ,true ); if ( 'page-branches.php' == $template) { global $wp_rewrite; $wp_rewrite->page_structure = $wp_rewrite->root . 'branches/%pagename%/'; } elseif ( 'page-modules.php' == $template) { global $wp_rewrite; $wp_rewrite->page_structure = $wp_rewrite->root . 'modules/%pagename%/'; } else{ global $wp_rewrite; $wp_rewrite->page_structure = $wp_rewrite->root . '%pagename%/'; } } add_action( 'add_meta_boxes_page', 'change_permalink_themebasis' );It works but the problem is that the front page gives an 404.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Give page theme custom Permalink 404’ is closed to new replies.