I’ve been developing a filtering with mixitup including hash url filtering support in WordPress. But one of the task, I need to catch up the after hash word and have to pass it into pure php string as variable. Like has this url and I want to get that “#slug_1” only.
<script>var hash = location.hash;</script>
<?php $hash_value = “<script>document.writeln(hash);</script>”;
After that, the hash value stored in that php variable but it didn’t work on any html inside tag where have another quotation mark on the wrapper of this variable. It showed the direct script there.
<a href=”<?php $hash_value; ?>”>Something</a>
So my question is, how can I achieve that value so that I can use it on any place with php?
If I have to use ajax to get that value, then could anyone please tell me a bit briefly about this process because I’m making this whole thing as shortcode as well from function file.
Read more here:: How to get after hash word from current page url