Created
October 14, 2015 21:05
-
-
Save nielsenrc/8ed94b12b99f90c45a28 to your computer and use it in GitHub Desktop.
Wix to Wordpress Redirect
This file contains hidden or 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
//this goes in functions.php because wix uris are unredirectable in apache htaccess | |
function themee_hash_redirects() { | |
?> | |
<script type="text/javascript"> | |
function themee_hashtag_redirect( hashtag, url) { | |
var locationHash = document.location.hash; | |
console.log(locationHash); | |
console.log(hashtag); | |
if ( hashtag == locationHash ) { | |
document.location.href = url; | |
} | |
} | |
// Examples how to use themee_hashtag_redirect | |
themee_hashtag_redirect('#!commercial/c1sh6', 'destination-uri'); | |
</script> | |
<?php | |
} | |
add_action('wp_footer', 'themee_hash_redirects'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment