Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //to auto break list of pages into colunms
- $list = wp_list_pages('title_li=&depth=1&echo=0'); //keep 'echo=0' and 'depth=1'; add all your parameters;
- $list_elements = explode('</li>', $list);
- $num = count($list_elements)-1;
- $num_col = 9; //set the max number per column
- $col = ceil($num/$num_col);
- $width = floor(100/$col)-5;
- $style = 'width:'.$width.'%;margin-right:2%;padding-left:3%;background: #eee;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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement