Hello everyone!
The WP-Multicollinks plugin works pretty well but it just flows the links horizontally, this is actually really easy to do with CSS. Don't get me wrong it is a great plugin.
However, I have been looking for a similar solution but I want the links to be evenly distributed between 3 columns and it lists them like so:
(Column 1) (Column 2) (Column 3)
Link 1 Link 4 Link 7
Link 2 Link 5 Link 8
Link 3 Link 6 Link 9
So I have cooked up a solution I want to share. I'm not a PHP 'Expert' by any means but this is working well for me.
Keep in mind you will need to alter it somewhat for 2 or 4 columns.
<?php
$term = get_term(2,'link_category') ;
$columns = round($term->count / 3);
$col1ct = $columns+1;
$col2ct = ($columns * 2)+1;
$linkCount = 1;
echo "<div id=\"linkCols\"><div id=\"col1\" class=\"col\">";
$linksX = get_bookmarks( array());
foreach ($linksX as $bookmark){
if($linkCount == $col1ct){
echo "</div><div id=\"col2\" class=\"col\">";
}
elseif ($linkCount == $col2ct){
echo "</div><div id=\"col3\" class=\"col\">";
}
?>
<a id='relatedlinks' href="<?php echo $bookmark->link_url; ?>" target=_blank>
<?php echo $bookmark->link_name; ?>
</a> <br /><br />
<?php
if($linkCount == $term->count){
echo "</div></div>";
}
$linkCount++;
}
?>
I put this code directly into a page template—you could easily create a function or a shortcode I imagine.
If you have any questions I will do my best to check this post.
I hope this helps.
*ian