Support

Account

Home Forums Add-ons Options Page Header and Footer Scripts in Options Reply To: Header and Footer Scripts in Options

  • Yes. You can create an options page for content to be added to the entire site. Set the formatting on the textarea field to no formatting and then in the header of footer include the content from the field.

    
      <?php the_field('my_code_field', 'options'); ?>
    </head>
    

    For individual pages/posts you’d do the same thing but, but you need to tell acf the right post ID

    
     <?php
       $queried_object = get_queried_object();
       if ($queried_object->ID) {
         the_field('my_code_field', $queried_object->ID);
       }
     ?>
    </head>