Created
February 9, 2015 21:28
-
-
Save kcpt-steven-kohlmeyer/f8b204b2a5555f1d0555 to your computer and use it in GitHub Desktop.
Virtual URL Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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