Using Custom Fields in Footer
-
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="https://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="https://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
- The topic ‘Using Custom Fields in Footer’ is closed to new replies.