1
我使用ACF的WordPress,我需要使用自定義字段作爲CSS類的寬度。作爲CSS類的高級自定義字段
我創建了一個活力四射的風格與變量:
<?php header("Content-type: text/css");
$scala = get_field('scala');
?>
#chart li .bar {
height: 10px;
background: #546a79;
width: <?php echo $scala ; ?> }
可惜我不能在網頁上看到的結果,但是如果我把一個精確值,那麼它的作品:
<?php header("Content-type: text/css");
$scala = '60%';
?>
#chart li .bar {
height: 10px;
background: #546a79;
width: <?php echo $scala ; ?> }
顯然我已經在帖子中註冊了自定義值。