I’m trying to find a creative solution to a problem I’ve got and need your generous help π
I’ve got a tracking script which I’ve got in my footer.php before the </body> tag. The problem is, each script is different for each page.
Here’s an example:
<script src="http://www.gotomerchant.com/tracking202/static/landing.php?lpip=946" type="text/javascript"></script>
The ‘946’ is manually generated elsewhere from the Tracking software.
For simplicity I want to be able to use a Custom Field to store this number. Then have something like the following in the footer to generate it:
function tracking_stuff() {
if (is_single() || is_page()) {
echo '<script src="http://www.gotomerchant.com/tracking202/static/landing.php?lpip=';
<<<<<<TRACKING NUMBER HERE>>>>>>>>();
echo '" type="text/javascript"></script>';
}
}
add_action('thesis_hook_after_html', 'tracking_stuff');
The only challenge is that because the footer is outside the loop, I am having issues calling the tracking number.
The above is a bit hacky but I’m only a beginner at PHP, does anybody know how to call Fields from outside the loop?
Would appreciate your help π
Max