Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ptm666

    (@ptm666)

    This works

    <?php
    header(‘Content-type: text/css’);
    $newBG = “darkviolet”;
    ?>
    
    #Box2 {
    background: <?php echo $newBG ?> !important;
    }
    
    #Box2 {
    background:red
    }

    This is not working:

    <?php
    header(‘Content-type: text/css’);
    $newBG = get_post_meta($post->ID, ‘custombg’, true);
    ?>
    
    #Box2 {
    background: <?php echo $newBG ?> !important;
    }
    
    #Box2 {
    background:red
    }

    Is there any chance to bring this dss into the loop that it knows the code? Or can I set this proberty somewhere else:
    $newBG = get_post_meta($post->ID, ‘custombg’, true);
    (customfield-key: custombg / value: yellow)

    • This reply was modified 7 years, 1 month ago by ptm666.
    • This reply was modified 7 years, 1 month ago by ptm666.
    Thread Starter ptm666

    (@ptm666)

    Its the last, so i dont need that “;” in this case, It′s just a test for me, so I know when another function is calling that background, because I set the first one on !important.

    The problem i have, is, i guess so, that i want to have informations outside the loop right?

    There are the normal php files of wordpress and plugins and so on. I changed style.css to style.css.php so that i can use dynamic code in css. It works somehow I just cant talk to the loop or the element. Its not working. When i bring simple wp calls like “the_meta();” it is not reading it. How can I solve this?

    Thx for your help!

Viewing 2 replies - 1 through 2 (of 2 total)