Customize li and a elements in code
-
Hello, I am trying to customize the display of wp_list_pages on this piece of code. This basically formats a list of 100 pages into 3 columns.
It works except that I would like to add more space between the links list elements.
Does anyone know how to apply line-height: 150%; to the a elements on this code? I tried variants of a $style_2 but cant seem to find a way to make it stick.
<?php $list = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); $list_elements = explode('</li>', $list); $num = count($list_elements)-1; $col = 4; //set the number of columns //$num_col = ceil($num/$col); $num_col = 35; $width = floor(100/$col)-1; $style = 'width:'.$width.'%;margin-right:3%;padding-left:1%;background: #ffffff;float:left;'; for( $i=1; $i<$col; $i++) { $list_elements[$i*$num_col] = '</ul> <ul style="'.$style.'">'.$list_elements[$i*$num_col]; } $list = implode('</li>', $list_elements); ?> <ul style="<?php echo $style; ?>"> <?php echo $list; ?> </ul>
The topic ‘Customize li and a elements in code’ is closed to new replies.