wekko
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: Blogroll split into 2 columns?livelearncreate’s solution is nice, but I changed it a bit. I wanted the link categories to be shown too. Also, I didn’t want to split up the categories. That means not every column will have the same height (except when they have the same amount of links) but that was not a big of a deal for me. If you still want that you should combine mine and livelearncreate’s code.
<?php $nrOfColumns = 5; $terms = get_terms('link_category', 'orderby=name') ; $rowsPerColumn = round(count($terms)/$nrOfColumns); for($i = 0; $i<$nrOfColumns; $i++) { echo '<div class="column" id="column-' . $i . '">'; for($j = ($i * $rowsPerColumn); $j<($rowsPerColumn * ($i+1)); $j++) { if(!isset($terms[$j])) continue; $bookmarks = get_bookmarks('category=' . $terms[$j]->term_id); ?> <h2><?php echo $terms[$j]->name; ?></h2> <ul> <?php foreach($bookmarks as $bookmark) { echo '<li><a href="' . $bookmark->link_url . '">' . $bookmark->link_name . '</a></li>'; } ?> </ul> <?php } echo '</div>'; } ?>The corresponding CSS:
#footer div.footer-menu .column { float: left; width: 170px; margin-right: 10px; } #footer div.footer-menu .column ul { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dotted #ccc; } #footer div.footer-menu h2 { font-size: 10pt; color: #fff; margin: 0; font-weight: bold; }You can change the number of columns by changing the $nrOfColumns variable to a different number. Also note the column width and margin width in the first line of the CSS.
Viewing 1 replies (of 1 total)