Thursday, July 15, 2010

Display list of wordpress pages in two columns

<?php

$page_s = explode("</li>",wp_list_pages('title_li=&echo=0&depth=1&style=none'));

$page_n = count($page_s) - 1;

$page_col = round($page_n / 2);

for ($i=0;$i<$page_n;$i++){

 if ($i<$page_col){

  $page_left = $page_left.''.$page_s[$i].’</li>’;

 }

 elseif ($i>=$page_col){

  $page_right = $page_right.”.$page_s[$i].’</li>’;

 }

}

?>

<ul class=”left”>

<?php echo $page_left; ?>

</ul>

<ul class=”right”>

<?php echo $page_right; ?>

</ul>


.right {float:left; width:200px;}

.left {float:left; width:200px;}



.right {float:left; width:200px;}
.left {float:left; width:200px;}

No comments:

Post a Comment