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
  2.  
  3. $links = $wpdb->get_results("SELECT * FROM $wpdb->links ORDER BY link_name ASC");
  4.  
  5. echo "<table border='0' class='linktable'>";
  6.  
  7. foreach ($links as $link) {
  8.  
  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;
  14.  
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.