Skip to content

Instantly share code, notes, and snippets.

@kcpt-steven-kohlmeyer
Created February 9, 2015 21:28
Show Gist options
  • Save kcpt-steven-kohlmeyer/f8b204b2a5555f1d0555 to your computer and use it in GitHub Desktop.
Save kcpt-steven-kohlmeyer/f8b204b2a5555f1d0555 to your computer and use it in GitHub Desktop.
Virtual URL Page
<?php
function add_custom_query_vars($vars) {
$vars[] = "sociallogin";
return $vars;
}
// hook add_query_vars function into query_vars
add_filter('query_vars', 'add_custom_query_vars');
function custom_rewrite_rule() {
add_rewrite_rule('login', 'index.php?sociallogin=1', 'top');
}
add_action('init', 'custom_rewrite_rule', 10, 0);
add_filter('template_include', 'my_template', 1, 1);
function my_template($template)
{
global $wp_query;
if ( isset( $wp_query->query_vars['sociallogin'] ) ) {
return dirname(__FILE__) . '/custom-login-page.php';
}
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment