Using the Wordpress Link Manager to Display Your Portfolio

For web designers or other businesses alike, setting up a quality portfolio is essential. This tutorial will show you how you can use Wordpress's Link Manager to create and display your portfolio. This will allow you to use Wordpress to it's fullest extent, without the need of extra plugins or any hacked code.
Step 1. Supplying the Data
Lets start off by populating our Links manager with some data. In the screenshot below you can see the fields that I am using:
- Name - Client Name
- Web Address - To link back to. This can either be an internal posting explaining the project in detail or the actual client website (which is what I use).
- Description - For title and alt attributes.
- Categories - Skills that were used in creating the project.
- Advanced: Image Address - Link to the screenshot of your project
- Advanced: Notes - Description of the project

Optional fields include "Target" where you can force your links to open into a new browser window and "Keep this link private." This is how you can set up a portfolio entry but not have it shown in the display on the site. This could be helpful for when you have a project finished, but you can't show it until it's live.
When you are finished adding all your portfolio entries, you can go to Your WP Dashboard > Manage > Links to see the full list.

Step 2. Display Your Portfolio
Wordpress has two different ways to display it's "bookmarks" which we are now using as portfolio entries. They are wp_list_bookmarks and get_bookmarks
We will use the get_bookmarks template tag because it allows us to manipulate how our "bookmarks" look. The only caveat is that this template tag returns an array - which we will need to use some PHP code to parse though it. To see the data that get_bookmarks outputs, I quickly added this little snippet to my code:
<?php
$arr_portfolio = get_bookmarks();
print_r ($arr_portfolio);
?>
The output from the print_r on get_bookmarks shows how the array is structured.
From that file, we can decipher enough to get the rest of the data echo'd out into an unordered list. The only thing that took a little tweaking was the fact that you have to find your own categories by running SQL on the wp_term_relationships and wp_terms tables in order to derive the category names by their id and the link's id.
<?php
$arr_portfolio = get_bookmarks();
//print_r ($arr_portfolio);
echo "<ul>";
foreach ($arr_portfolio as $site) {
echo "<li>";
echo "<h3>". $site->link_name ."</h3>";
echo "<a href=\"". $site->link_url ."\" title=\"". $site->link_description ."\">";
echo "<img src=\"". $site->link_image ."\" /></a>";
echo "<p>". $site->link_notes ."</p>";
$cats = $wpdb->get_results("SELECT * FROM wp_term_relationships, wp_terms WHERE wp_term_relationships.object_id = $site->link_id AND wp_terms.term_id = wp_term_relationships.term_taxonomy_id");
echo "<p>Skills Used: ";
foreach ($cats as $cat) {
echo $cat->name .", ";
}
echo "</p></li>";
}
echo "</ul>";
?>
The great thing is that this code doesn't need to be placed within the_Loop. It will work great within it's own template or on the sidebar.
View the demo portfolio using this code.


