Wordpress bookmarks custom

/ Published in: PHP
Save to your folder(s)

I didn't like the way my bookmarks came out with wp_list_bookmarks or any other built-in function, so I figured out a way to have total control about the way your wordpress bookmarks are displayed.
In this example I wanted a table with the Bookmark-image in the left column and title and description in the right column.

Copy this code and paste it in your HTML
  1. <?php
  3. $links = $wpdb->get_results("SELECT * FROM $wpdb->links ORDER BY link_name ASC");
  5. echo "<table border='0' class='linktable'>";
  7. foreach ($links as $link) {
  9. $linkurl=$link->link_url;
  10. $linkdesc=$link->link_description;
  11. $linkname=$link->link_name;
  12. $linkimage=$link->link_image;
  13. $linknotes=$link->link_notes;
  15. echo "<tr><td><a href='$linkurl' target='_blank'><img src='$linkimage' alt='$linkurl' border='0' class='linkimg'></a></td>";
  16. echo "<td valign='top' class='link-desc'><h5>$linkname</h5>";
  17. echo "<div class='link-description'>$linkdesc </div></td></tr>";
  18. }
  19. echo "</table>";
  20. ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.