WP_Get_Referer & Divs???
-
I found out how to track where a click is from and then display elements based on where that click was from. I did it through “wp_get_referer”. Here is the code I set up:
<? $referer = $_SERVER['HTTP_REFERER']; if ( $referer == "https://www.testdomain.com/testpage" ) { echo '<div id="bgphotos"></div>'; } else { echo '<div id="bgvideos"></div>'; } ?>
So this is telling my website to display the “bgphotos” div when a link is clicked on from “https://www.testdomain.com/testpage” and then display the “bgvideos” div when a link is clicked on from anywhere else. This works great!!
Now the current problem I’m having is that on my main website I’m going to have a section called news, a section called videos and a section called photos. I’d like to track where these clicks are from just like I did above. But these sections are not pages, they are divs. So that is where it gets tricky.
Again, I would like to track where clicks are from in a specific div / section and not just a page. If anyone knows if this is possible or knows a solution of any sort, please let me know. ?? It would honestly mean soooo sooo, sooo, soo much to me, it honestly would!
- The topic ‘WP_Get_Referer & Divs???’ is closed to new replies.