Support

Account

Home Forums General Issues putting a snippet in the functions.php Reply To: putting a snippet in the functions.php

  • This should do the trick. Simply add it to your functions document. the \n is a line break to make your code look nicer when it spits it out.

    
    add_action('wp_enqueue_scripts', 'customJsFunction'); 
    function customJsFunction(){
    	global $post;
    	$script= get_field('header_script',$post->ID);
    	if($script){
    		echo '<script>'."\n".$script."\n".'</script>'."\n";
    	}
    }