Support

Account

Home Forums ACF PRO why finding the solution to create dynamic css is so difficult?

Unread

why finding the solution to create dynamic css is so difficult?

  • why finding the solution to create dynamic css is so difficult and only complex solutions are always found?

    I write the solution that I found by digging in google. write in functions.php

    add_action('wp_head', 'childtheme_header_style', 100);
     
     
    function childtheme_header_style() {
     
        global $num_header_widgets;
    ?>
    <style type="text/css">
    #css_ID {
    	border-top: 16px solid <?php the_field('name_of_field_color','options'); ?>;
    }
    </style>
    <?php
    }
     
    ?>

    remember to pass “option” to the_field() function.

    now you have the style directly in the page and in the header, you can write minify or not.

    finished.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.