i have short question which is probably super easy to answer but i'm with stupid today..
can someone please tell me the proper syntax to close the <h4>
in my array and explain the correct syntax to me? thanks!
<?php
wp_nav_menu(
array(
'theme_location' => '1st_menu',
开发者_运维知识库 'before' => '<h4 '<?php if ( is_page('5')) { echo ' id="visible"'; } ?> >',
'after' => '</h4>'
)
);
?>
I guess something like :
<?php
wp_nav_menu(
array(
'theme_location' => '1st_menu',
'before' => '<h4 '.(is_page('5') ? ' id="visible"' : '').' >',
'after' => '</h4>'
)
);
?>
wp_nav_menu(
array(
'theme_location' => '1st_menu',
'before' => '<h4 '. (is_page('5') ? ' id="visible"':'').'>',
'after' => '</h4>'
)
);
don't know about WP but that should be:
<?php
if(is_page('5')){
$id = ' id="visible" ';
}else{
$id = NULL;
}
wp_nav_menu(
array(
'theme_location' => '1st_menu',
'before' => '<h4'.$id.'>',
'after' => '</h4>'
)
);
?>
精彩评论