Home Forums General Issues PHP ACF Template in Javascript?


PHP ACF Template in Javascript?

  • Is it possible to reference a ACF in Java?
    I have a .PHP template which contains some Java embed code.
    I then wanted a section of this to reference a field from ACF called fixtures_live_id.

    This loads most of the code but unfortuntly misses out the ACF field.
    Can anyone advise how this would ideally be done? I’ve removed the <?php tags which also make no difference

    <div id="fl" style="width:100%;"><!-- FL API data --></div>
    <script language="javascript" type="text/javascript">
    var fPassKey = '';
    var fStartPage = 'STATZONE_MATCH:'<?php.get_field('fixtures_live_id'); ?>
    <script src=""></script>	
  • Hi @kylerlawrence

    I think that should work but I’ve noticed you have a . right between <?php and get_field.. remove that!

    You’re also not closing your JS properly..
    Try this

    var fStartPage = "STATZONE_MATCH:<?php echo get_field('fixtures_live_id'); ?>";
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘PHP ACF Template in Javascript?’ is closed to new replies.