php - Add a string after each item in Wordpress menu -
i trying add special character display » alongside each menu item in wordpress.
so example
about » contact » , on...
here's code
<li><?php echo $children; echo '»'; ?></li>
i expected job, puts » below list.
here's full code
<?php if($post->post_parent) { $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); $titlenamer = get_the_title($post->post_parent); } else { $children = wp_list_pages("title_li=&child_of=".$post->id."&echo=0"); $titlenamer = get_the_title($post->id); } if ($children) { ?> <h2 class="left_title"> <?php echo $titlenamer ?> </h2> <ul class="left_body"> <li><?php echo $children; echo '»'; ?></li> </ul>
if $children variable concatenate string using .
.
you'd echo $children.'»';
however, $children array, or @ least list of items menu, require concatenating each item in list.
<li> <?php foreach ($children $child){ $child = $child.'»'; ?> </li>
this trick think, i'm not sure structure of $children.
side note: use »
in place of ».
Comments
Post a Comment