PHP generated CSS not taking effect


What I have:

Astyle-color.php document that dynamically writes/outputs CSS code that should ordinarily be applied to my website's pages (note: this is a theme file for a WordPress based website).

My problem:

The file works perfectly locally however does not on my live website. By process of elimination, the only real difference that come to mind between my local and live environments are security hardening measures I've applied to the live environment and potentially chmod settings.

Security hardening: I've disabled various security hardening measures but to no avail.


chmod settings: Thestyle-colors.php is contained inthemes > some-theme-name > style-colors.php and the respective permissions are755 > 755 > 644.

My question:

Is there anything obvious I'm overlooking with regards to the permissions or anything else that might be preventingstyle-colors.php from behaving as it should?




try this code it be work.

    $root = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
    if ( file_exists( $root.'/wp-load.php' ) ) {
        require_once( $root.'/wp-load.php' );
    } elseif ( file_exists( $root.'/wp-config.php' ) ) {
        require_once( $root.'/wp-config.php' );
    header("Content-type: text/css");
    // start output buffer

        color:<?php echo $theme_color;?>;

People are also looking for solutions to the problem: php - Group array row data by two columns creating a new 3-level structure


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.