functions.php – inject inline css from file

You need to add your css to wp_head. In order to do so, you need to get your dynamic CSS first, load in into a variable and then add that variable to the head output. Just like so:

(This code can go into your functions.php, plugin file or somewhere else in your theme, make sure you include this code in a file where it can be called properly)

<?php

  function so_output_dynamic_css() {
    // do some stuff to get your CSS here..
    $some_dynamic_css = "body {background: green;}";
    ?>
    <style type="text/css" id="so-dynamic-css">
         <?php echo $some_dynamic_css; ?>
    </style>
  <?php }
  add_action('wp_head', 'so_output_dynamic_css');