Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
Created October 14, 2015 21:05
Show Gist options
  • Save nielsenrc/8ed94b12b99f90c45a28 to your computer and use it in GitHub Desktop.
Save nielsenrc/8ed94b12b99f90c45a28 to your computer and use it in GitHub Desktop.
Wix to Wordpress Redirect
//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