WordPress tutorials: Links with description

Wpsnipp – Adding this to your wordpress theme will allow you to specify a category using a custom field thecat to display a listing of links / bookmarks.As you can see in the image there is an option for link description. Just check it, and it will be displayed.

 

 

<?php $theCat = get_post_meta($post->ID, 'thecat', true); ?>
<table>
<thead>
<tr>
<th>Bookmark</th>
<th>Description</th>
</tr>
</thead>
<?php
$bookmarks = array();
$bookmarks = get_bookmarks("category=$theCat");
if ($bookmarks[0] != '') { ?>
<?php foreach ( $bookmarks as $bookmark ) {?>
<tr <?php if($i%2 == 0){ ?> class="odd"<?php $i++; }else{ $i++; } ?>>
<td><a title="<?php echo $bookmark->link_description; ?>" href="<?php echo clean_url($bookmark->link_url); ?>"><?php echo $bookmark->link_name; echo $bookmarks->term_id; ?></a></td>
<td><?php echo $bookmark->link_description; ?></td>
</tr>
<?php }} ?>
</table>

Be Sociable, Share!

Leave a comment