I’m using the wp_list_bookmarks() function in wordpress to get links that have been added in the WordPress back-end, things like blogroll etc.
My problem is that I need the list to come out in a certain way so that I can put it into columns, with about 5 links in each column.
By default it’s just one big list. Is there a way that I can use PHP to alter the way this function posts the links so that I run a counter, and then after 5 links close off the current list and start a new one for the next column?
I basically need something like this:
<ul class="column-1">
<li>link1</li>
<li>link2</li>
<li>link3</li>
<li>link4</li>
<li>link5</li>
</ul>
<ul class="column-2">
<li>link6</li>
<li>link7</li>
<li>link8</li>
<li>link9</li>
<li>link10</li>
</ul>
// etc...
Thank you in advance.
You can use WordPress’s get_bookmarks() function and then tailor the output to your liking. See here for an example:
Reference: http://codex.wordpress.org/Template_Tags/get_bookmarks#Examples