我有一个简短的问题,可能非常容易回答,但我今天很愚蠢..
谁能告诉我关闭 <h4>
的正确语法吗?在我的数组中并向我解释正确的语法?谢谢!
<?php
wp_nav_menu(
array(
'theme_location' => '1st_menu',
'before' => '<h4 '<?php if ( is_page('5')) { echo ' id="visible"'; } ?> >',
'after' => '</h4>'
)
);
?>
最佳答案
我猜是这样的:
<?php
wp_nav_menu(
array(
'theme_location' => '1st_menu',
'before' => '<h4 '.(is_page('5') ? ' id="visible"' : '').' >',
'after' => '</h4>'
)
);
?>
关于php语法问题。 (在 php 数组中的 css 中的 php),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5119538/