Support

Account

Home Forums Front-end Issues ACF Admin Head Styles Reply To: ACF Admin Head Styles

  • Changed the image field to ID and calling it this way now…still getting invalid property value.

    <!--USER INPUT STYLES FUNCTION-->
        <?php function my_acf_admin_head() {
        
        $backgroundimage = get_field('background_image', 'option');
                $backgroundimgsize = 'full';
                $backgroundimg_array = wp_get_attachment_image_src($backgroundimage, $backgroundimgsize);
                $backgroundimg_url = $backgroundimg_array[0];
        
            ?>
            <!--BEGIN USER INPUT STYLES-->
            <style type="text/css">
                
                /**Adds custom global background image**/
                .main-content {
                    background: url ("<?php echo $backgroundimg_url; ?>");
                }
                
            </style>
            <?php
        }
        add_action('wp_head', 'my_acf_admin_head');
        ?>
        <!--END USER INPUT STYLES-->