Reputation: 67
Can't see to update my style.php file with the following
Here is my style.php coding..
<?php header("Content-type: text/css; charset: UTF-8");
$fontColor = "#<?php echo get_option('mwg_font_paragraph'); ?>";
?>
#content p {
color: <?php echo $fontColor; ?>;
}
If clear out that link and manually enter a color, it works fine:
$fontColor = "#FF0000";
Any suggestions would be greatly appreciated..
Upvotes: 0
Views: 1814
Reputation: 3534
As Nirpendra stated, you're using PHP inside PHP. Your code should look like this instead:
<?php header("Content-type: text/css; charset: UTF-8");
$fontColor = "#" . get_option('mwg_font_paragraph');
?>
#content p {
color: <?php echo $fontColor; ?>;
}
When you want to concatenate (join) multiple values together in PHP, whether they be strings, function calls, variables or something else, you need to use the .
to join them, rather than nest additional PHP tags.
All the <?php ... ?>
tags do is indicate what code PHP should parse, and when you're inside those tags, it's already parsing what you write.
Upvotes: 1