I am trying to output custom CSS and footer script for individual pages using textarea field type. I have added this code to the header.php file to start.
if( get_field('custom_page_css')) {
$customCss = the_field('custom_page_css');
echo '<style type="text/css" media="screen">' . $customCss . '</style>';
}
The issue is, the css outputs outside the <style></style> tag.
.acf-style { display:none; }
<style type="text/css" media="screen"></style>
the_field() always echos the value of the field.
$customCss = get_field('custom_page_css');
if($customCss) {
echo '<style type="text/css" media="screen">' . $customCss . '</style>';
}