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&child_of='.$post->ID.'&sort_column=menu_order&show_date=modified&date_format=$date_format');?>
- '); //keep 'echo=0' and 'depth=1'; add all your parameters;
- $list_elements = explode('</li>', $list);
- $num = count($list_elements)-1;
- $num_col = 5; //CHANGE HERE FOR THE NUMBER OF ITEMS PER COLUMN
- $col = ceil($num/$num_col);
- $width = floor(100/$col)-5;
- $style = 'width:'.$width.'%;margin-right:2%;padding-left:3%;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