Passing php variablesUpdated: October 10th, 2018
Created: 10/10/18In making a widget to show the current user's posts, I had to get the php $current_User->.
This was achieved by
1. adding code to the header so that it was global and could be called from anywhere.
<script>
var uid = "<?php echo $current_User->ID; ?>";
</script>
2) then a FreeHTML widget called the javascript variable: javascript being usable in the FreeHTML widget
<script>
url="https://calstock.org.uk/?disp=useritems&user_ID=" + uid;
document.write("<a href=" + url + ">My Posts :: <em>All collections/a>");
</script>