我有一個單一的主題我在我的WordPress的使用,但我想改變我的'內容div'手動使用PHP這是目前我正在嘗試做的事:WordPress的如果條件添加樣式到div
<div id="main" class="site-main">
<div class="content" style="<?php if (is_page('Contact Us'){ echo 'width: 870px;'; } ?>">
<div class="lft">
<?php if(have_posts()) : ?>
<?php while (have_posts()) : the_post() ?>
<div class="horizontal-divider">
<h1><?php the_title(); ?></h1>
</div>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="rgt">
<?php
get_sidebar();
?>
</div>
</div>
</div>
<?php get_footer(); ?>
,你可以看到這行:
<div class="content" style="<?php if (is_page('Contact Us'){ echo 'width: 870px;'; } ?>">
就是我試圖使用PHP的div大小更改爲100%,但我不斷收到此錯誤:
Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\wp\aaco\wp-content\themes\aaco-theme\index.php on line 4
對不起,菜鳥的錯誤。^_ ^ –