Works like a charm
-
WordPress 3.5 and .html on PAGES 1.1 worked like a charm for me. I tested in debug mode and didn’t get a single warning—hence the 5 stars.
As a side note: I needed to hack the plugin to output the “.htm” suffix instead of “.html”. Having to do so anyway, I added a (hopefully) unique prefix to all functions and removed the closing PHP tag (
?>
) at the end of the file for security reasons.Here’s my final plugin code:
add_action( 'init', 'pageshtm_html_page_permalink', -1 ); register_activation_hook( __FILE__, 'pageshtm_active' ); register_deactivation_hook( __FILE__, 'pageshtm_deactive' ); function pageshtm_html_page_permalink() { global $wp_rewrite; if ( ! strpos( $wp_rewrite->get_page_permastruct(), '.htm' ) ) $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.htm'; } add_filter( 'user_trailingslashit', 'pageshtm_no_page_slash', 66, 2 ); function pageshtm_no_page_slash( $string, $type ) { global $wp_rewrite; if ( $wp_rewrite->using_permalinks() && $wp_rewrite->use_trailing_slashes==true && $type == 'page' ) return untrailingslashit( $string ); else return $string; } function pageshtm_active() { global $wp_rewrite; if ( ! strpos( $wp_rewrite->get_page_permastruct(), '.htm' ) ) $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.htm'; $wp_rewrite->flush_rules(); } function pageshtm_deactive() { global $wp_rewrite; $wp_rewrite->page_structure = str_replace( '.htm', '',$wp_rewrite->page_structure ); $wp_rewrite->flush_rules(); }
- The topic ‘Works like a charm’ is closed to new replies.