WordPress
0
Вклад в тег
function dynamic_page() {
$uri = $_SERVER['REQUEST_URI'];
$path = wp_parse_url( $uri, PHP_URL_PATH );
if (isset($_SERVER['HTTPS'])) {
$scheme = $_SERVER['HTTPS'];
}
else {
$scheme = '';
}
if (($scheme) && ('off' !== $scheme)) {
$scheme = 'https';
}
else {
$scheme = 'http';
}
if ( '/services.php' === $path ) {
include plugin_dir_path( __FILE__ ) . 'templates/services.php';
die();
}
if ( '/webhook.php' === $path ) {
include plugin_dir_path( __FILE__ ) . 'templates/webhook.php';
die();
}
}
add_action( 'init', 'dynamic_page' );