Skip to content

Instantly share code, notes, and snippets.

@mjangda
Created August 7, 2018 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjangda/387aaf4f44204a0f6235db91aaca8dcb to your computer and use it in GitHub Desktop.
Save mjangda/387aaf4f44204a0f6235db91aaca8dcb to your computer and use it in GitHub Desktop.
<?php
add_action( 'init', function() {
$html_map = [
'howdy/world' => 'howdy',
];
$current_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
if ( in_array( $current_path, array_keys( $html_map ), true ) ) {
$filename = $html_map[ $current_path ];
$contents = file_get_contents( __DIR__ . '/docs/' . $filename . '.html';
echo $contents;
exit;
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment